This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate: Updating version in child records 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 "Hibernate: Updating version in child records" Watch "Hibernate: Updating version in child records" New topic
Author

Hibernate: Updating version in child records

Jim Cross
Greenhorn

Joined: Nov 20, 2003
Posts: 17
In my test application, I have two tables; J_TRADE and J_CASHFLOW. Trades may have zero-to-many associated cashflows.

J_TRADE has ID as its primary key, and a version column.
J_CASHFLOW references the trade ID column and the trade VERSION column.


The mappings are as follows:



Clearly from this, the cashflow class isn't aware that it references the trade version. So, while the cashflow trade id does get populated correctly on insert, the cashflow trade version doesn't.

Is there any way to make the cashflow reference the trade version, without making ID and VERSION a composite key in the trade table, and having to handle the trade id and version increments myself?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate: Updating version in child records
 
Similar Threads
Auto Generator in composite key
HBM mapping Problem
Why a select statement, not an insert ?
Hibernate - Legacy Database Question
Hibernate causing Concurrent Modification Exception