-->
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.  [ 3 posts ] 
Author Message
 Post subject: transaction isolation with ejb3
PostPosted: Thu Mar 23, 2006 12:01 pm 
Newbie

Joined: Tue Mar 07, 2006 7:20 am
Posts: 16
I'm using Hibernate with default EntityManager in J2SE with PersistenceContextType Transaction instead of Extended.

I posted a lot about that already in this poll: http://forum.hibernate.org/viewtopic.php?t=956814 so make sure you read that as well. (it became off topic)

Now my questions is regarding the transaction isolation setting that Hibernate should configure via JDBC.

It is clearly stated that EJB3 implementations should default to a "read commited" transaction isolation" to implement a default optimistic concurrency control.

I think this goes against the statement of the Hibernate documentation. Here's the quote (from http://www.hibernate.org/hib_docs/entitymanager/reference/en/html/transactions.html):

Quote:
Hibernate Entity Manager only adds automatic versioning but does not lock objects in memory or change the isolation level of your database transactions.


Now what if I want that read commited isolation, can I specify it somewhere? Is it a bug now?

(for those who did not read my previous posts, I'm using MSSQL2000 and jTDS)

I'd like to welcome any suggestions and/or thoughts


Top
 Profile  
 
 Post subject:
PostPosted: Sat Mar 25, 2006 9:35 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
The spec expect a read commited isolation level for optimistic locking, it does not mandates. You can chose the isolation level you want.

hibernate.connection.isolation

Check the hibernate core ref doc for more infos

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 28, 2006 4:59 am 
Newbie

Joined: Tue Mar 07, 2006 7:20 am
Posts: 16
OK thanks,

I'll add these lines to my persistence.xml (in a J2SE app, for an Application Server you will need to setup it elsewere)

<property name="hibernate.connection.isolation" value="2"/>
<!-- see java.sql.Connection -->

This should do TRANSACTION_READ_COMMITTED.

I think lots of othere people may want to do the same. See Hibernate in Action, chapter 5, Transactions, Concurrency and Caching


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