This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate trying to insert recursive object - I don't want it to Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate trying to insert recursive object - I don Watch "Hibernate trying to insert recursive object - I don New topic
Author

Hibernate trying to insert recursive object - I don't want it to

chris gar
Ranch Hand

Joined: Jul 20, 2002
Posts: 45
I have a class with a recursive association:



the parent is optional but I don't think I have the correct mapping. Every time I try to insert a record with a null parent, it tries to insert a new one for the parent once the child is created. The parent field should only reference a preexisting object in the database.

Here is the error message


I'm sure it's something silly in my mapping. Any suggestions?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate trying to insert recursive object - I don't want it to
 
Similar Threads
How to insert a new child record only. One to Many Relation.
hibernate class A containing a list of B
Problem in many to one relation.
org.hibernate.exception.GenericJDBCException
problems with hibernate: one-to-many and arrays