-->
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.  [ 1 post ] 
Author Message
 Post subject: Updating a collection and optimistic locking
PostPosted: Thu Sep 05, 2013 7:09 pm 
Newbie

Joined: Fri Sep 03, 2010 6:27 pm
Posts: 8
Location: Munich
The entity 'Ticket' has a collection 'Lines'. I use optimistic locking and access the entity from different instances of the application and must make sure that each instance reliably gets the most recent version of both 'Ticket' and 'Lines'.

I've set

Code:
@Cascade({org.hibernate.annotations.CascadeType.SAVE_UPDATE


(and also tried ALL), and it works as expected when I either

  • delete an element from the collection or
  • add an element to the collection

and then save the related 'Ticket'. Version numbers of both Ticket and Lines get incremented.

If I update an existing collection item and then save the related 'Ticket' the Lines version is incremented, but the Tickets version is not and another instance will not recognize that the Lines collection has changed.

I'm banging my head about this behaviour. Am I missing something?
I could possibly introduce an updated_at property for 'Ticket' and set it to the current timestamp to force 'Ticket' to be dirty but I can't believe that this should be necessary.

Any advise is very much appreciated.


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

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.