• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

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?
 
Yeah, but is it art? What do you think tiny ad?
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic