You are reading Aha - Hibernate and composite keys. You can leave a comment or trackback this post.
Posted on December 14th, 2006 by arnljot.
Categories: java.
This is old news to most people I guess. But I’m currently working with a legacy database where I can’t just go and do a “alter table” statement and introduce “@hibernate.version” or something to get saveOrUpdate() to work in the session.
Currently all operations created an insert…
So this is what I finally read on the topic(7.4. Components as composite identifiers):
You may instead implement Interceptor.isUnsaved() if you wish to use saveOrUpdate() or cascading save / update. As an alternative, you may also set the unsaved-value attribute on a (or ) element to specify a value that indicates a new transient instance. In this case, the version of the entity is used instead of the (assigned) identifier and you don’t have to implement Interceptor.isUnsaved() yourself.
So! A slight change in the persistance layer, and I think I’ll be fine ![]()
0 comments.
Comments can contain some xhtml. Names and emails are required (emails aren't displayed), url's are optional.