File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
vaijesh basavarajappa
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic