• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Aaaaaand ... we're on the march. Stylin. Get with it tiny ad.
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic