wood burning stoves 2.0*
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 Android Security Essentials Live Lessons this week in the Android 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Child and Parent Saving On Null and Not Null
 
Similar Threads
How to query a value typed object
Hibernate 3.0 : Where am I going wrong?
self referencing relationship - many selects from hibernate
Hibernate nested joined-subclass
@PrimaryKeyJoinColumn with bidirectional @OneToOne relationship and @Id