File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes what isolation level should be used for basic CRUD operation in spring JTA Transaction. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "what isolation level should be used for basic CRUD operation in spring JTA Transaction." Watch "what isolation level should be used for basic CRUD operation in spring JTA Transaction." New topic
Author

what isolation level should be used for basic CRUD operation in spring JTA Transaction.

vaijesh basavarajappa
Greenhorn

Joined: Feb 04, 2013
Posts: 5
Hi,
what isolation level should be used for basic CRUD operation in Spring JTA Transaction.

I have one java project and 2 Web Applications which are bundled in EAR.
In java project i have service classes and DAO classes which are shared between web application using Spring configured using context param parentContextKey .
And web application specific DAO 's are in web application project.
DAO 's does basic CRUD operations.
I my using @persistenceContext which injected is injected in DAO using Spring.

so my question is which isolation level should i use when i annotated the method with @Transaction.By default ISOLATION_SERIALIZABLE is used.
what is isolation_default level will do.

Please help to understand when to use ISOLATION_SERIALIZABLE and ISOLATION_DEFAULT.Considering the above scenario please help me to choose isolation level if any thing else i need to use.
And also we are going to create Clusters for the EAR in Websphere Application Server.Does isolation level have any impact on the Clusters.
Please help me.
Thanks in Advance.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

"when i annotated the method with @Transaction.By default ISOLATION_SERIALIZABLE"

Um, the default setting in @Transactional is Isolation.DEFAULT. Which means it takes the databases default. Each database has its own default setting for isolation level, and Spring will use that.

I know of no database that has a default of Serializable. That is extreme and the slowest. You use that only for life or death use cases. Typically the database will use READ_COMMITTED or REPEATABLE_READS.

If you know the use case is only going to query, then set readOnly="true"

Typically, when using @Transactional you never do any setting inside the annotation because the defaults cover at least 90% of the use cases.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
Don't get me started about those stupid light bulbs.
 
subject: what isolation level should be used for basic CRUD operation in spring JTA Transaction.