• 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
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

Is the statement about EJB 3.x right?

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear All,

a transaction management type can not be specified for ejb 3.x entiites?

but I think it can, I make a test on glass fish, my test structure

servlet--> statefull bean--> entity can be successfully run. the city data can be inserted in to the database.




[Edit - added code tags = MB]
 
Ranch Hand
Posts: 754
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe that EJB will ignore this annotation on an entity. @TransactionManagement(TransactionManagementType.BEAN)
 
Ranch Hand
Posts: 2198
1
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!
EJB 3.x entities are, as far as I understand, classes annotated with JPA annotations.
In a Java EE environment, entities are usually manipulated by EJBs or other components, for which transaction management is specified.
Note that because you have managed to create an example program that runs on GlassFish does not mean anything - there are cases when GlassFish allows certain behaviour that does not adhere to EJB 3.1 specifications.
Reference: Section 13.3.6 EJB 3.1 specification.
Best wishes!
 
Yingjie Liu
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks for your reply, I checked the specification and there is another statement on the specification I do not understand

" The transaction management type of a bean is determined by the Bean Provider. The application assembler
is not permitted to use the deployment descriptor to override a bean’s transaction management type regardless of whether it has
been explicitly specified or defaulted by the Bean Provider. "

Does that mean application assembler can not use the 'transaction-type' to perform the overriding?


Thanks,
Yingjie



 
Ivan Krizsan
Ranch Hand
Posts: 2198
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!

Yingjie Liu wrote:
Does that mean application assembler can not use the 'transaction-type' to perform the overriding?


Exactly.
If you think about it, changing the transaction type from BEAN to CONTAINER may render an EJB useless - any calls related to the object implementing UserTransaction would suddenly fail with system exceptions.
The transaction type is closely coupled to the code of the EJB class.
Best wishes!
 
Yingjie Liu
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Got it, Thank you very much!
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic