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 Child and Parent Saving On Null and Not Null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Child and Parent Saving On Null and Not Null" Watch "Child and Parent Saving On Null and Not Null" New topic
Author

Child and Parent Saving On Null and Not Null

Eric Juneau
Greenhorn

Joined: Jul 13, 2009
Posts: 28
I have an object called Person. In the database table for person, there's a person_id (primary key) and parent_id. This parent_id refers to another person in the table, so a person can be the parent of another person, or not a parent at all.

When I try and save a Person where parentPerson is a null value, I get this error: non-transient entity has a null id

When I try and save a Person with a non-null parent, it does seem to save correctly, but I get this error: org.apache.cxf.interceptor.Fault: EL1008E:(pos 10): Field or property 'parentId' cannot be found on object of type 'com.mypackage.package.Person'

I'm not especially savvy on the hibernate keywords, so what do I need to change to help this along?

PersonServiceImpl.java


Person.java
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Child and Parent Saving On Null and Not Null