-->
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.  [ 8 posts ] 
Author Message
 Post subject: 5.1.7 Using pessimistic locking
PostPosted: Thu Nov 18, 2004 9:38 am 
Newbie

Joined: Wed Oct 06, 2004 4:39 pm
Posts: 17
Hi,

If I try the example of the page 167, I obtain the exception "reassociated object has dirty collection", because the collection of bids is dirty.

To solve this problem, is correct add "session.update(item);" before "session.lock(item, LockMode.READ);".

Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 18, 2004 9:42 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Yes, thats an error in the book. I'll add it to the errata.

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


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 10, 2005 8:31 pm 
Newbie

Joined: Tue Jan 11, 2005 5:01 pm
Posts: 10
I'm sorry but the errata reads:

167, code block, the explanation in the third paragraph ("saving the associated Bid by cascade") is wrong and needs a complete rewrite. Use saveOrUpdate() instead of lock().

This is a little unclear. Could you provide a more precise explanation of what the incorrect text and replacement text should be?

Also, it also isn't clear when the last update to the errata list was made. I know you made one fairly recently (for p. 37) but the update date is from December and didn't change.

Thanks much!

Dan


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 10, 2005 9:13 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Please continue this discussion in the user forum, the usage of lock() is simply wrong and you should ignore the advise given in this paragraph. Correct would be to use saveOrUpdate().

I don't see an easy way how I can add timestamps to my errata updates. I think sorting them by page is the best we can do.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 10, 2005 9:14 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
In other words, just ignore the whole paragraph and don't try to figure out what it means and why it doesn't really work like this.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 10, 2005 9:31 pm 
Newbie

Joined: Tue Jan 11, 2005 5:01 pm
Posts: 10
christian wrote:
I don't see an easy way how I can add timestamps to my errata updates. I think sorting them by page is the best we can do.


Couldn't you manually write one in when you make the update? Like at the top or bottom, "The info was last updated at #####".

Just a thought.

Dan


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 10, 2005 9:34 pm 
Newbie

Joined: Tue Jan 11, 2005 5:01 pm
Posts: 10
christian wrote:
In other words, just ignore the whole paragraph and don't try to figure out what it means and why it doesn't really work like this.


I'm not trying to sound dense, but which paragraph? The one that begins "By default..." and ends "...has cascading enabled)."? And if so are you saying no part of that section of text is correct?

Thanks,

Dan


Top
 Profile  
 
 Post subject:
PostPosted: Thu Feb 10, 2005 9:46 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
Ignore this: "before saving the new Bid by cascade (assuming that the association from Item to Bid has cascading enabled)."


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 8 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.