wood burning stoves 2.0*
The moose likes Architect Certification (SCEA/OCMJEA) and the fly likes JavaEE Business and persistence, what is SessionBean, what is not? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Architect Certification (SCEA/OCMJEA)
Bookmark "JavaEE Business and persistence, what is SessionBean, what is not?" Watch "JavaEE Business and persistence, what is SessionBean, what is not?" New topic
Author

JavaEE Business and persistence, what is SessionBean, what is not?

Alexandre Fradin
Greenhorn

Joined: Jul 28, 2008
Posts: 17
Hi,

I am preparing SCEA certification and I have a good understanding of EJBs, but I use to develop web-centric application with Spring where everything is POJO.
So I have some troubles to distinguish what is SessionBean or not in business and persistance layers.

Basicly in a web-centric Spring application I use the fold architecture :

Web tiers                                              | Business tier                | persistance tier
Backing bean <-> Business Delegate <-> Facades <-> Services <-> DAOs

I think that I can keep the same architecture in EJB-centric application (right?).

While Facades are necessary SessionBean, what about Services and DAOs? Pro & Cons?

If we want to rely on EJB resource injection mecanism at least DAOs should be SessionBean in order to resolve EntityManager. But we could use Spring (Spring EJB) to do that.
Is it a common practice?

Thanks.

raj sirohi
Ranch Hand

Joined: Mar 02, 2010
Posts: 35
Hi Alexandre,

This is what I think.

"Basicly in a web-centric Spring application I use the fold architecture :

Web tiers | Business tier | persistance tier
Backing bean <-> Business Delegate <-> Facades <-> Services <-> DAOs

I think that I can keep the same architecture in EJB-centric application (right?)"

IMHO I would include service locator between business delegate and facades. This will decouple web tier from business tier.
DAO are called EAO ( entiry access objects ) now. since you are using session bean you can inject entity manager in the session bean and forego EAO/DAO, however I think its better to use EAOs that way all queries. CRUD operation are not sprinled all over the place.

Regards
Raj


SCJP5.0 , SCBCD5.0, SCEA
Alexandre Fradin
Greenhorn

Joined: Jul 28, 2008
Posts: 17
Ok thanks.

But which option is the best one for business layer between :
1) everything is SessionBean (Facades, Services, EAOs/DAOs)
or
2) just Facade is a Session bean in order to delimit transaction and the role restrictions, Service and EAOs/DAOs are POJOs. Spring might be used to provdie injection mecanism.

Annotations made EJB3 simpler, so the first one is easy to implement.
But what about performance? EJBs use more resources than POJOs, is it a good practice to implement everything as EJB while only Facade need transaction and security services?

Regards.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JavaEE Business and persistence, what is SessionBean, what is not?
 
Similar Threads
Dark side of EJBs: bad use?
Ant javac task and subdirectories
Learning resource for EJB
SCEA 1.5/1.6
Strict separation of tiers