object references an unsaved transient instance - save the transient instance before flushing: user.pojo.HotelGoodsCatalog; nested exception is org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: user.pojo.HotelGoodsCatalog
今天遇到修改对象的时候,hibernate报有关联的对象没有保存,其原因为hibernate在更新一个对象的时候,会去检查它所有关联的对象在数据库中是否存在,如果不存在就会报先让你保存这个对象,然后再保存此对象。也可以将cascade="none" 设为其它,如save-update等等,但是这种方法最好不要用(以上只是我个人的理解)
补充:
另外一种情况也会发生此错误,即:当你保存一个对象时User,User关联一个Card对象,而Card对象是增加了乐观锁,如果新建了一个Card对象放进User中,而Card中乐观锁的属性为null的话,这时你需要将其属性设定一个值,最好从数据库中取出
分享到:
相关推荐
10_传智播客JPA详解_JPA中的一对多双向关联与级联操作.rar
3.Caused by:org.hibernate.TransientObjectException:object references an unsaved transient instance 原因:代码中关联的对象没有set值进去。查看代码,发现是enterPriseStrength和enterprise为多对一
hibernate4.3.5references chm文档
NULL 博文链接:https://xiongjiajia.iteye.com/blog/1947270
* 有人总以为有了关系数据库知识,就能用好Hibernate,这是认识上的误区;很多人总是先有数据表结构,然后使用Hibernate倒推类代码,这是使用上的误区,从对象模型出发才是根本之道。 * 只有真正掌握了OO面向对象...
10.1. Hibernate object states 10.2. Making objects persistent 10.3. Loading an object 10.4. Querying 10.4.1. Executing queries 10.4.1.1. Iterating results 10.4.1.2. Queries that return tuples 10.4.1.3...
an object is an instance of a class with its fields set to specific values. Objects are persistent and exist on the server-side. Clients may obtain opaque references to these server-side objects and ...
Object References and Requests IDL Type System IDL Type Operations Request Type Checking IDL to Java Binding IDL to Java Compiler Obtaining Object References The Client's Model of Object Creation ...
10.1. Hibernate对象状态(object states) 10.2. 使对象持久化 10.3. 装载对象 10.4. 查询 10.4.1. 执行查询 10.4.1.1. 迭代式获取结果(Iterating results) 10.4.1.2. 返回元组(tuples)的查询 10.4.1.3. 标量(Scalar)...
This article describes an introductory object-oriented finite element program for static and dynamic nonlinear applications. This work can be considered as an extension of the original FEM_Object ...
references/detection/engine.py , references/detection/utils.py 和 references/ detection/transforms.py
3 hibernate annotation references 5 环境准备 5 1 下载hibernate-distribution-3.3.2.GA-dist 5 2 下载hibernate-annotations-3[1].4.0.GA 5 3 注意阅读hibernate compatibility matrix(hibernate 网站download) 5...
References.rar
This library defines an object oriented representation of the GitHub API. By "object oriented" we mean there are classes that correspond to the domain model of GitHub (such as GHUser and GHRepository)...
Feature 1 - Project Cleaner: 1、Actions for unused files 2、Enhanced Project View Feature 2 - Find References: 1、Find references, usages, relationships easily in ...2、Explore usages & references
20.5 AN OBJECT-ORIENTED ARCHITECTURE 684 20.6 DISCUSSION 693 20.7 BIBLIOGRAPHICAL NOTE 694 Chapter 21: Inheritance case study: “undo” in an interactive system 695 21.1 PERSEVERARE DIABOLICUM 695 ...
Laravel开发-static-references-laravel Laravel应用程序的静态引用
6 - Common Operations Gives an example of the resources that may be accessed and the representations used to modify them 7 - Interface Standard Provides a description of HTTP status codes, Cloud Data ...
The names in the above hierarchy tree are object references to HFSS Automation object. The process of creating object references is done automatically after starting to record scripts in HFSS.
torch.vision.references.detection包,集成了train_one_epoch、evaluate等重要函数