wood burning stoves*
The moose likes Object Relational Mapping and the fly likes Would like advise mapping Hibernate objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Would like advise mapping Hibernate objects" Watch "Would like advise mapping Hibernate objects" New topic
Author

Would like advise mapping Hibernate objects

Sharon whipple
Ranch Hand

Joined: Jul 31, 2003
Posts: 294
Hi all,
Would like guidance mapping objects in Hibernate
I keep getting Error :
org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1

I have Table "persons" Person is related to other persons through relation table (relations)
PersonHib - holds 2 collection of "relation" objects - children, parents (need this connection in order for the relation record to hold relation data)
RelationHib - hold 2 references Parent, and Child (both PersonHib)
I Would like to be able to persist the parents through RelationHib

What is the right way of mapping this situation?

For example:




My current mapping :
PersonHib:

RelationHib:
Sharon whipple
Ranch Hand

Joined: Jul 31, 2003
Posts: 294
Anyone?
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Sorry, I use Annotations, so I won't be much help with the xml.

But where is the <id> for the person mapping?

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Sharon whipple
Ranch Hand

Joined: Jul 31, 2003
Posts: 294
Mark Spritzler wrote:Sorry, I use Annotations, so I won't be much help with the xml.
But where is the <id> for the person mapping?
Mark


I omitted irrelevant fields for the example,
Anyway Person have ID mapping.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Would like advise mapping Hibernate objects
 
Similar Threads
Hibernate mapping : Parent ->Child(Male or Female)
retrieving object hierarchy - many-to-one?
Hibernate 3.0 : Where am I going wrong?
Parent child join query
hibernate get parent based on children