| Author |
Hibernate: How do I configure Default Isolation Level?
|
Darya Akbari
Ranch Hand
Joined: Aug 21, 2004
Posts: 1855
|
|
Hi, I like to activate an Isolation Level for all my transactions. My App Server is JBoss, my ORM system is Hibernate and my Database is Oracle. Hence the chain all my transactions have to pass is: JBoss -> Hibernate -> Oracle As far as I understand it, I have two choices for activating and using an isolation level: (A) Use the Database's default isolation level(B) Use a concrete isolation level by choice JBoss offers me a way to tell it, which isolation level I want have activated, through its jboss-service.xml or oracle-ds.xml files. Hence option (B) could be done this way. For example, I could tell JBoss to use the TRANSACTION_READ_COMMITTED isolation level by just adapting one of above XML files in case this wouldn't be the database's isolation level. Actually in my special case of an Oracle database TRANSACTION_READ_COMMITTED would be the default level. But here I talk more generally. But how is it with option (A) If I want to use the default isolation level, is there anything I have to do in Hibernate or JBoss? Or is it the default that if you don't do anything in regard to isolation level that you automatically run your transaction in the database's default isolation level mode? Any hints?
|
SCJP, SCJD, SCWCD, SCBCD
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
Hibernate will just use whatever the DataSource is configured to use I think. In JBoss I think you add a transaction-isolation element to your DataSource file to configure this.
|
JavaRanch FAQ HowToAskQuestionsOnJavaRanch
|
 |
Darya Akbari
Ranch Hand
Joined: Aug 21, 2004
Posts: 1855
|
|
Originally posted by Paul Sturrock: In JBoss I think you add a transaction-isolation element to your DataSource file to configure this.
Yes, that's the way you must go for when you want another isolation level than the default isolation level. I got some feedback that when you don't change anything in JBoss, it will use the default isolation level for its transactions.
|
 |
Paul Sturrock
Bartender
Joined: Apr 14, 2004
Posts: 10336
|
|
|
Well, unless you tell it otherwise, the DataSource will just use the default settings.
|
 |
 |
|
|
subject: Hibernate: How do I configure Default Isolation Level?
|
|
|