These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Assigned id examples
PostPosted: Sun Feb 24, 2008 11:14 am 
Newbie

Joined: Fri Feb 22, 2008 5:39 am
Posts: 14
Hi,

I'm looking for some examples with assigned ids cascading saves and updates. I managed to work cascading saves and updates with native ids but can't make it work with assigned or composite-id.

Thanks for you help in advance,

_________________
Thomas JASKULA - NODEVO
1, avenue du Général de Gaulle
60500 - Chantilly
+33 (0)3 44 26 36 72


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 25, 2008 8:33 am 
Senior
Senior

Joined: Thu Feb 09, 2006 1:30 pm
Posts: 172
You should add a version column to your tables with natural keys (assigned ids).

You need to do something like this since the cascade works via the save-update method. save-update uses the value of the id by default to know if it is a new item or an existing item. That's why you'll see something like unsaved-value="0" on ids.

Obviously with an assigned id, it would always look like an update, and cascading saves wouldn't work.

If you add a version column save-update can actually use that version instead of the id. There basically would be an unsaved version (possibly 0) which would be used for this determination. Add the version column and then set the unsaved-value on the version entity to the appropriate value.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.