-->
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.  [ 6 posts ] 
Author Message
 Post subject: unsaved-value="undefined" in hibernate 3
PostPosted: Mon Nov 08, 2004 10:36 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
Hello,
I see in hibernate 3 changelog
introduced unsaved-value="undefined", the default for "assigned" ids and <composite-id>, which forces Hibernate to hit the db

Is it mean that hibernate do lock automatic when exists legacy client (performance isn't important)

regards


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 08, 2004 10:39 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
1) No, Hibernate will first check version/timestamp properties and Interceptors, as always

2) I don't think this is related to locking and legacy databases? Do you really mean read locks because of select-before-update with saveOrUpdate() (with detached objects, thats were you would consider setting an unsaved-value)?

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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 08, 2004 12:00 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
Christian,
I don't understand all, but I want update database with hibernate and another non hibernate client
Option 1 is session for application antipattern and lock upgrade. Is there another option ?

regards
Haris Peco


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 08, 2004 12:04 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
No, option one is "Application Transaction implementation using Long Session, with interceptors and possibly thread local's".

In this case, if you can't update the database schema (and put in a version or timestamp column), you should use optimistic-lock="all" on your class mappings, telling Hibernate to compare "all fields" of old and new rows to check for concurrent updates.

Another application accessing the same tables concurrently would usually implement the same strategy (if it doesn't have an optimistic "last commit wins" strategy).

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


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 08, 2004 1:25 pm 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
Christian,
Where is description "Application Transaction implementation using Long Session, with interceptors and possibly thread local's"
I have Hibernate in Action and reference documentation

Another client (application) use lock for update (one connection for application) - for instance,
sqlplus in oracle do update direct

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 08, 2004 2:24 pm 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
That is called pessimistic locking and something completely different. You are looking for chapters 4 and 8 in HiA, please read them several times ;)

_________________
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.  [ 6 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.