-->
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: guarding the cardinality of an association
PostPosted: Sat Oct 09, 2004 8:19 am 
Newbie

Joined: Thu Sep 25, 2003 7:21 pm
Posts: 17
I've been going thru the docs and I can't seem to find an answer to this, supose you have a book entity and it can hold a maximum of 3 chapter entities, How would you prevent that race conditions happen where more than 3 are added in concurrent sessions?

eg:

Say you'd load the parent book enity in both sessions, they would get added to the first level (transaction scope) cache, now both sessions have a seperate refference to the parent. say the book had allready 2 chapters attached a bussinesslogic check for book.chapters.size() > 3 would both return true but when you add an entity to both objects you'd end up with 4! violating my constraint


Top
 Profile  
 
 Post subject:
PostPosted: Sat Oct 09, 2004 9:04 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Database constraints.

_________________
JAVA PERSISTENCE WITH HIBERNATE
http://jpwh.org
Get the book, training, and consulting for your Hibernate team.


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.