Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / May 2006

Tip: Looking for answers? Try searching our database.

Regarding EJBs

Thread view: 
Ravi Shankar Nair - 18 May 2006 16:35 GMT
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
John Holliday - 19 May 2006 08:25 GMT
> Hi all,
>
[quoted text clipped - 4 lines]
> 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.
Ravi Shankar Nair - 19 May 2006 16:14 GMT
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
>> Hi all,
>>
[quoted text clipped - 38 lines]
> persistence with session bean facades and the application maintainability
> ,development speed and performance has increased dramatically.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.