• 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

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.
 
Bartender
Posts: 3680
38
  • 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
Bartender
Posts: 3680
38
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic