File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes TransientObjectException: object references an unsaved transient instance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "TransientObjectException: object references an unsaved transient instance" Watch "TransientObjectException: object references an unsaved transient instance" New topic
Author

TransientObjectException: object references an unsaved transient instance

Shajid Johnny
Ranch Hand

Joined: May 15, 2010
Posts: 34
Dear members,

I am new to Hibernate.
I have been trying to build an application that has the modules: Add/Edit/Delete of Categories, SubCategories, Articles.

SubCategory has a Many-to-one association with Category and Article has a many-to-one association with SubCategory.

here is the hbm.xml files:

SubCategory.hbm.xml


Article.hbm.xml


Thus I have done the unidirectional many-to-one associations.
Now, I can successfully Add/Edit/Delete both Category and SubCategory, but when I try to add an Article, it displays the following Exception:
javax.servlet.ServletException: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before fl

could you please give me a solution to the problem??
Ankit Garg
Sheriff

Joined: Aug 03, 2008
Posts: 9280
    
  17

Can you show us the code which is throwing the exception. Is the SubCategory object which the Article references to saved in the database??


SCJP 6 | SCWCD 5 | Javaranch SCJP FAQ | SCWCD Links
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TransientObjectException: object references an unsaved transient instance
 
Similar Threads
Hibernate many-to-one association does not work properly
Hibernate: many-to-many cascading
Cascade delete to the parent association
Hibernate Mapping (Many-To-One Association). Problem. This forum is my last hope.
Hibernate Many to Many association does not update database