• Post Reply Bookmark Topic Watch Topic
  • New Topic

TransientObjectException: object references an unsaved transient instance

 
Shajid Johnny
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9597
36
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show us the code which is throwing the exception. Is the SubCategory object which the Article references to saved in the database??
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!