• 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
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

Do we need specify transaction attribute for ejbRemove of Entity Bean

 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On P498, for Entity bean, we have to specify the transaction attribute for those business methods, removes from both interfaces, create () etc.
My question is "should we specify transaction attribute for ejbRemove, ejbCreate () etc, or the Container will take care of these ejbMethod"?

thanks
 
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Section 17.4.1 of the spec enumerates all methods for which transaction attribtues must or must not be specified:


The transaction attribute must be specified for the following methods:
[...]
For an entity bean, the transaction attributes must be specified for the methods defined in the bean�s component interface and all the direct and indirect superinterfaces of the component interface, excluding the getEJBHome, getEJBLocalHome, getHandle, getPrimaryKey, and isIdentical methods; and for the methods defined in the bean�s home interface and all the direct and indirect superinterfaces of the home interface, excluding the
getEJBMetaData and getHomeHandle methods specific to the remote home interface.
[...]



As you can see, there is no mention of the ejbMethods... If you come to think about it, this is pretty normal as the ejbMethods are called by the container as a result of a client interaction. For instance, when the client invokes create() on the home interface, ejbCreate will be called on the bean class and the transaction context will be propagated so there is no need to specify the transaction attributes for both create() and ejbCreate(). The same goes for the other methods...

Does this make sense to you?
 
Jingyi Wang
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But for entity bean, we do have to specify some Transaction Attribute for create method since this method will involve in database insert, right?
Anyway, your explanation does make sense to me.
Thanks a lot
 
Valentin Crettaz
Author & Gold Digger
Posts: 7617
6
IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But for entity bean, we do have to specify some Transaction Attribute for create method since this method will involve in database insert, right?
What you do is actually to specify a transaction attribute for the home interface of the entity bean and not for the entity bean itself. See the difference?
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic