• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Exception in a transaction question

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hiii

My question:

in EJB spec 2.0 the concepts :

"If the clients executes in a transaction,the client's transaction is not marked for rollback,and client can continue its work"

is confusing for me

Can help me?

Thanks !!

Gabriele
 
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

"If the clients executes in a transaction,the client's transaction is not marked for rollback,and client can continue its work"



means:

the client of a EJB (that may be also an EJB) is running in a transaction, perhaps he made already some DB-changes. He calls annother EJB that has the transaction attributte, let's say "RequiresNew". This second EJB marks its transaction with "setRollbackOnly" (in the case of CMT). All DB-changes that were made by this second EJB are rolled back. However, since the client run's in his own transaction context, he may still commit the changes.

this behaviour would be different if second EJB would run with "requires". Then it would run in the same transaction context as the client, and all changes (those of the caller as well as those of the calle) would be rolled back.


Hope it helps :roll:

Severin
 
gabriele rigamonti
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Severin..

Thanks,now is clear

another precisation and for me the concepts are ok:

(in EJB spec pag 376) if the method trow ad example a runtime error i read that (the client) : "if the client executes in a transaction,the client's transaction may or may not be marked for roll back"

Can explain please the may or may not?

Thanks in Advance Severin

Gabriele
 
Severin Stoeckli
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's the same as before:

- if the client runs within the same transaction as the EJB it calls, the transaction will be rolled back. This is the case if the EJB's method is marked "Required" or "Supports".

- if the client runs with annother transaction context, ( "RequiresNew", "NotSupported" and "Never"), the client's transaction will not be rolled back.



hmm... its the first time I see a use for this "Supports" transaction attribute. :roll:




Severin
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic