[jboss-user] [EJB/JBoss] - Executing Outside Transaction

murtuza52 do-not-reply at jboss.com
Tue Dec 19 06:56:57 EST 2006


Hello, 

I am using JBoss 4.0.5, Eclipse 3.2 on windows XP. MySQL 5.0 as backend.

I have strange scenario, where in a stateless session bean, i am counting number of times a method A is called as per application requirement. The scenario is put in psuedo code as follows:


  | SessionBean1{
  | @TransactionAttribute(REQUIRED)
  |  methodA() throws exception{} 
  | 
  | @TransactionAttribute(REQUIRED)
  |  methodB() throws exception{}
  | }
  | SessionBean2{
  |  count(){
  |      read counter from database and increase counter
  |   }
  | }
  | 

The counter must increase even when the methodA() is throws exception. The method execution is:
methodA() -> count() -> methodB()

The database changes that occur in all these methods are OK when things go right and all methods are executed sucessfuly. The peoblem occurs when any of the method throws exception. The changes are rolled back including the counter. Is there anyway i can execute count() method outside transaction so the changes in the database are not rolled back. 

I am sure we can set database to read_uncommit but this is not what the rest of the application requires except for count table which is used to store count.

I'll appreciate your quick response.

Regards,
Murtuza

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3994950#3994950

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3994950



More information about the jboss-user mailing list