jpa - What kind of transaction context does an injected EntityManager have in an EJB whose transaction context is TransactionAttributeType.NOT_SUPPORTED? -


suppose have ejb annotated with:

@transactionattribute(transactionattributetype.not_supported) 

suppose further has entitymanager injected it:

@persistencecontext private entitymanager em; 

if perform various operations on entitymanager, resource-local transaction started , committed each such operation? or there 1 of them? or behavior undefined jpa specification? not find suitable paragraph either way in either jpa 2.0 specification or ejb 3.1 specification.

i understand there not jta transaction started ejb method, not clear on kinds of transactions in effect underlying entitymanager. presuming behavior undefined i'm hoping larger stackoverflow community knows better, or has insight area of specification, or discussions dealt area.

below few excerpts jsr 318 & section 13.6.5 might clear of questions.

13.6.2.1 not_supported

the container invokes enterprise bean method transaction attribute set not_supported value unspecified transaction context.

if client calls transaction context, container suspends association of transaction context current thread before invoking enterprise bean’s business method. container resumes suspended association when business method has completed. suspended transaction context of client not passed resource managers or other enterprise bean objects invoked business method.

if business method invokes other enterprise beans, container passes no transaction context invocation.

13.6.5 handling of methods run “an unspecified transaction context”

the ejb specification not prescribe how container should manage execution of method unspecified transaction context—the transaction semantics left container implementation. techniques how container may choose implement execution of method unspecified transaction context follows (the list not inclusive of possible strategies):

  • the container may execute method , access underlying resource managers without transaction context.
  • the container may treat each call of instance resource manager single transaction (e.g. container may set auto-commit option on jdbc connection).
  • the container may merge multiple calls of instance resource manager single transaction.
  • the container may merge multiple calls of instance multiple resource managers single transaction.
  • if instance invokes methods on other enterprise beans, , invoked methods designated run unspecified transaction context, container may merge resource manager calls multiple instances single transaction.
  • any combination of above.

as mentioned above in specification section 13.6.2.1, context interaction between client & container being described.

in section 13.6.5, underlying mechanism of container handling such transaction being described, depends on implementation.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -