-->
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.  [ 9 posts ] 
Author Message
 Post subject: Dirty read
PostPosted: Tue Sep 07, 2004 6:14 pm 
Beginner
Beginner

Joined: Mon Feb 23, 2004 5:11 pm
Posts: 39
I have a table with limited number of rows (say 50) in my application that will be heavily used (read only) by the entire application. All data is versioned. Every time I read a row, the row is locked and will be released only when the transaction is committed. But most of the time, the records in this table are read for display purposes only. There could be other things that happen in the same tranaction that needs to be committed after some processing. But I dont want the other transactions to wait on the lock on this display-only record. How do I accomplish this?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Sep 07, 2004 6:45 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
put them on 2nd level cache

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 08, 2004 6:40 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
read only don't request transaction
- it is bad assumptions in hibernate that read only query have to in transaction

regards


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 08, 2004 7:08 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
This has been debunked in another thread. "Read operations don't require transaction demarcation if the database management system uses a multi-version concurrency model." In other words, always use transaction demarcation.

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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 08, 2004 7:24 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
There is yet another thread.In other words, You havn't to use transaction for read only operations if your database have good MVC model

regards


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 08, 2004 7:27 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
You know, it would be better if you don't tell people to break their applications for no apparent reason :)

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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 08, 2004 7:38 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
yes, I know
It is simple ; if You have oracle you can do query without transaction
(it isn't important if you have autocommit off or on)
If You have postgresql you have to do query in transaction
for another databases, I don't know

regards


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 08, 2004 7:40 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
No no, please don't do that. It's simple: You use Hibernate. It gives you database independence. Use transaction demarcation.

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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 08, 2004 7:58 am 
Expert
Expert

Joined: Sat Jun 12, 2004 4:49 pm
Posts: 915
Christian,
You are headstrong.
Except this, it isn't important for bshaw's question - problem is bshaw's database and he have to use transaction, probably
database with good transaction managment have rule - reader stop never writer and writer stop never reader - it is true in transaction and without
transaction
Bshaw,
If read lock another transaction then you change database

regards


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