• 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
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

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

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Alexandre Fradin
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Time flies like an arrow. Fruit flies like a banana. Steve flies like a tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic