• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Why CMT session bean must specify for all business methods in the component interface

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, everyone,

HFEJB Page 509, it says that A CMT session bean must specify attributes for all business methods in the component interface. I am confused.

For example, I have a business method advice() in the component interface, it just returns a piece of advice generated by the session bean, why it MUST be specified a transaction attribute? Who could explain for me? Thank you very much.
 
Saloon Keeper
Posts: 3946
43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Steven Gao Song:
Hi, everyone,

HFEJB Page 509, it says that A CMT session bean must specify attributes for all business methods in the component interface. I am confused.

For example, I have a business method advice() in the component interface, it just returns a piece of advice generated by the session bean, why it MUST be specified a transaction attribute? Who could explain for me? Thank you very much.



Hello, this is a requirement of EJB 2.0 (ejb-2_0-fr2-spec.pdf):

Please look at page 351 of EJB 2.0 (section 17.4.1) :


The transaction attribute must be specified for the following methods:

� For a session 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 methods of the javax.ejb.EJBObject or
javax.ejb.EJBLocalObject interface. Transaction attributes must not be specified for
the methods of a session bean�s home interface.
...



They (attributes) must be defined either by Application Assembler or Deployer.

regards,
MZ
 
Steven Gao Song
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you, Mikalai.

But I have another question.

Transaction attributes are used to specify the bean methods, right?

However, the spec says "the methods defined in the bean�s component interface". Tran-attributes are used to specify the bean methods, or
the methods in client-view?
 
Ranch Hand
Posts: 154
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think the container will invoke the ejbLoad and ejbStore to synchronize the data ,so when client invoke the biz method,the container will synchronize the data,so require transcation.
 
Mikalai Zaikin
Saloon Keeper
Posts: 3946
43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Steven Gao Song:
Thank you, Mikalai.

But I have another question.

Transaction attributes are used to specify the bean methods, right?

However, the spec says "the methods defined in the bean�s component interface". Tran-attributes are used to specify the bean methods, or
the methods in client-view?



Howdy !

Specification says about only methods from bean�s component interface.
So, they are (1) declared in component interface (2) implemented in bean class. 8-)

You may add as many as you want helper methods in bean [implementation] class, but they should not have transaction attribute in DD.

regards,
MZ
 
Steven Gao Song
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok. I got it. Thank you all.
 
Yeast devil! Back to the oven that baked you! And take this tiny ad too:
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