-->
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.  [ 2 posts ] 
Author Message
 Post subject: Transaction settings related question
PostPosted: Tue Mar 09, 2010 12:36 pm 
Beginner
Beginner

Joined: Wed Mar 03, 2010 3:35 pm
Posts: 37
when one service method which has tx setting as propagation="REQUIRES_NEW" invokes another service method with the same settings, does the second method use the same session or does it create a new one(assuming the default contextual settings are used)? If not what decides whether a new session is opened or the existing one is used in the invoked method, it would be great if someone can make this clear. thanks,


regards
Aravias


Top
 Profile  
 
 Post subject: Re: Transaction settings related question
PostPosted: Wed Mar 10, 2010 3:26 am 
Newbie

Joined: Wed Mar 10, 2010 3:12 am
Posts: 3
The "REQUIRES_NEW" means that it will always start a NEW transaction for the called service. But you're question still have 2 answers possible because you have to know (if you do not already) that transactional annotations only work on "Spring beans" which mean that if you have :

Code:
@Transaction(Propagation=REQUIRES_NEW)
class ServiceA implements IServiceA
{
   public void methodA()
  {
     methodB();
  }
  public void methodB()
  {
     someCode;
  }
}

Even if methodB gets the @Transaction annotation (from global class), if called inside methodA() it will not get a new transaction because the method is not called through Spring proxy.
Is it clear ?


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