-->
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: Cascading dirty saves to parents
PostPosted: Thu May 20, 2004 6:21 pm 
Newbie

Joined: Thu May 06, 2004 2:57 pm
Posts: 7
I'm trying to implement a model that handles multi-user concurrent changes. To explain what I'm trying to do, I'll use the example of a group entity containing many person entities.

    1. User 1 loads the group named "developers".
    2. User 2 loads the same group.
    3. User 1 adds "developer1" to the group and saves it.
    4. User 2 adds "developer2" to the group and saves it.
    5. Both users are able to save their changes without a StaleObjectStateException occuring, because they did not change the group, only its children.


I would like to be able to prevent two users from editting the same group at the same time. It seems like the logical way of doing that is to dirty the parent (group) when the child (person) is added.

Is there an easy way to automatically get hibernate to increment the version of the parent object in this case? Is there a better approach to achieve the same thing? If I have to manually implement dirtying the parent, is there a way to mark an object dirty without changing its values?

Thanks for your help,

Jonathan


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.