aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Container-Managed Transaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Container-Managed Transaction" Watch "Container-Managed Transaction" New topic
Author

Container-Managed Transaction

Pavan Shahi
Ranch Hand

Joined: May 01, 2006
Posts: 39
@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 ]

SCJP 1.4 (93%)<br />SCBCD 5 (96%)
Rodrigo Lopes
Ranch Hand

Joined: Feb 29, 2008
Posts: 119
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

Joined: Jan 09, 2008
Posts: 91
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

Joined: May 30, 2006
Posts: 185
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 ]


 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Container-Managed Transaction
 
Similar Threads
Mock Question about Transactions
Is this a nested transaction?
Exceptions in lifecycle callback methods (I)
setRollbackOnly() related question
EJB 3.0: Doubt in Transaction