Regarding EJBs

R

Ravi Shankar Nair

Hi all,

This is to clarify a question popped up in out discussion.

Assume that I have an EJB with two functions fn1 and fn2. Please note that
only fn1 is exposed to outside world, i.e as business method. fn2 is a
private method in the EJB. The questions are, does the EJB specification
allow

1) To have as many private, public or protected mthods in EJB, but only some
of them are exposed as business methods?

2) Can fn1 call fn2 within the EJB ?

3) ***Most important*** When fn1 calls fn2, will the invocation call go out
of the container( from fn1) and come back ( to fn2) ?

Please help, because we need to implement this in out architecture, thanks a
million.

Best regards,
Ravi
 
J

John Holliday

Ravi said:
Hi all,

This is to clarify a question popped up in out discussion.

Assume that I have an EJB with two functions fn1 and fn2. Please note that
only fn1 is exposed to outside world, i.e as business method. fn2 is a
private method in the EJB. The questions are, does the EJB specification
allow
The term Entity Java Bean (EJB) may refer to Message-Driven,
Stateless/Stateful Session or Entity beans. For the purpose of my
response I will assume you are talking about a stateless session bean
although it may hold for some of the other types. In addition, by
functions I assume you refer to "methods" and therefore fn1 and fn2 are
declared methods.
1) To have as many private, public or protected mthods in EJB, but only some
of them are exposed as business methods?
Yes. Although best practise would be to have helper classes to avoid the
use of excessive private utility method definitions in the EJB classes.
There are some restrictions
2) Can fn1 call fn2 within the EJB ?
Yes. If the method fn1 is transactional then the transaction attributes
of fn1 would set the transactional scope for fn2.
3) ***Most important*** When fn1 calls fn2, will the invocation call go out
of the container( from fn1) and come back ( to fn2) ?
No. Not unless you call it via its remote interface. The reason for
calling it via its remote interface may be to allow CMT transaction
demarcation if the method is transactional. I would visit the Sun EJB
reference site for further information.
Please help, because we need to implement this in out architecture, thanks a
million.

Best regards,
Ravi
See comments above. From experience, I have found Entity Beans to be a
nightmare. I modified our application architecture to use Hibernate for
persistence with session bean facades and the application
maintainability ,development speed and performance has increased
dramatically.
 
R

Ravi Shankar Nair

Hi John,

Thanks a lot for the reply and your time. Please let me know if you get some
more information from ejb spec, thanks

Regards,
Ravi
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top