• 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 wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

TransactionRequiredException

 
Ranch Hand
Posts: 393
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why does methods like merge, persist thrown transactionRequired Exception is method is invoked on a transaction-scoped persistence context?

Does this mean that, these methods can only be invoked on extended persistence context?
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That is not true. Those methods trown TransactionRequiredException only when no transaction is available. The default transaction attribute for container managed ejb beans is REQUIRED. If you use merge, persist within transaction everything will be fine. Maybe you have set transaction attribute on business method wich invoke merge, persist to : NEVER , NOT_SUPPORTED or SUPPORTS. In this case container will not create transaction context and exception may be thrown.

I suggest you to read JSR 220 specification for further informations.
"EJB Core Contracts and Requirements" pages from 343 to 345
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic