Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Container-Managed Transaction

 
Pavan Shahi
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Stateless
@TransactionManagement(CONTINER)
public class MySessionBean implements MySession
{
@TransactionAttribute(REQUIRED)
public void methodA()
{
. . . .
methodB(); // call to non business method
}



@TransactionAttribute(REQUIRED_NEW)
private void methodB()
{
}
}


//business interface
@Remote
public interface MySession
{
public void methodA();
}


As for core spec page no 330

Only these methods can specify transaction attribute
The enterprise bean�s business methods, message listener methods, business method interceptor methods,
lifecycle callback interceptor methods, or timeout callback method

Considering this we can not specify transaction attribute on methodB() which is not a business method. But I am not sure why ?

Please correct me if I am wrong. Is my understanding is wrong ?

Thanks
Pavan Kumar

[ May 21, 2008: Message edited by: Pavan Shahi ]

[ May 21, 2008: Message edited by: Pavan Shahi ]
[ May 21, 2008: Message edited by: Pavan Shahi ]
 
Rodrigo Lopes
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Business methods are the methods defined in your business interface.
In this case, MySession interface, which defines only methodA().

By the way, use the CODE tags when posting source code.
[ May 30, 2008: Message edited by: Rodrigo Lopes ]
 
bernard savary
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Only these methods can specify transaction attribute
The enterprise bean�s business methods, message listener methods, business method interceptor methods,
lifecycle callback interceptor methods, or timeout callback method


I have doubt realted the above , how could transaction attributes be applied for lifecycle call interceptor methods. Life cycle method do not execute with under any security or transaction context.Can someone tell me how it makes sense to apply transaction attribute on lifecycle callback interceptor methodslifecycle callback interceptor methods. thanks !
 
nitin pai
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not clear about your question. But still I can conclude that, if your methods are not defined in the interface then,it doesn't mean that, they are not business methods. They are exposed business methods. The methods which are not defined in the interface can also be termed as business methods and hence cna be involved in the same transaction semantics as that of an exposed method.
[ June 02, 2008: Message edited by: nitin pai ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic