24

I have a method in service layer which does the update functionality to database.

@Transactional(propagation = Propagation.REQUIRES_NEW)
public void update(final Object obj){
    // some code here
}

Now I want to know what is the isolation level for this method set by Spring framework?

I am a newbie to Spring, just wanted to make myself comfortable with transactions.

Please share some best practice and ways to set isolation level to avoid deadlocks and thus preventing same user trying to update his record from different browsers.

informatik01
  • 16,038
  • 10
  • 74
  • 104
Sekhar
  • 961
  • 5
  • 15
  • 27

1 Answers1

16

According to the docs (Isolation.DEFAULT), it uses

Use the default isolation level of the underlying datastore.

As you are using the @Transactional annotation, I would set the isolation level there, e.g.:

@Transactional(propagation=Propagation.REQUIRES_NEW, isolation=Isolation.SERIALIZABLE)
beny23
  • 34,390
  • 5
  • 82
  • 85
  • 1
    That's correct, but be sure you really need REQUIRES_NEW and SERIALIZABLE. These are usually only needed for something like managing your own sequences. The defaults should be fine for an update. – AngerClown Mar 07 '12 at 14:52
  • 1
    @beny23, so if i am right my application will use the default isolation level set by oracle database. Correct ? – Sekhar Mar 11 '12 at 14:40
  • 4
    It is READ COMMITTED. See http://www.oracle.com/technetwork/issue-archive/2005/05-nov/o65asktom-082389.html. – BPS Jul 30 '15 at 16:11