Win a copy of Terraform in Action this week in the Cloud forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Open transaction in SLSB/MDB

 
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
A stateless session/message-driven bean has to complete the transaction, before the method ends. What happens if the transaction is kept open?...
Will there be an exception and what happens to the open transaction?
RemoteException/EJBException for remote/local clients?
 
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vish,
As the container must ensure that rule, I guess that it will throw some system exception in case your bean doesn't conform to it. Which one, I don't know (but I'd like to BTW ).
Now if a system exception is well thrown, another rule will be applied anyway : the open transaction will be rollbacked.
Regards,
Phil.
 
Cowgirl and Author
Posts: 1589
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, Phillipe is right -- if the stateLESS bean or MDB starts but does not complete a transaction in a business method, the Container will:
* Log it as an error
* roll back the transaction
* discard the bean instance
* For STATELESS beans -- throw RemoteException or EJBException depending on whether the client is remote or local
* For MessageDrive beans -- no exception is thrown, of course, because there's no client to get it!
So, the only difference between MDBs and SLSBs in this case, is that the Container won't thrown an exception with a MDB, but in both cases, the bean is destroyed, the transaction rolled back, and the problem is logged.
cheers,
Kathy
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic