• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

EJB components as delegators to POJOs

 
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The business logic is usually implemented in Plain Old Java Objects and to take advantage of EJB features, EJB components are simply used to delegate method calls to these POJOs. This adds overhead (an extra function call from the EJBs) but is usually a common design. A benefit of this is to make testing easy, one can easily test the POJOs out of the EJB container, but are there any other benefits of this paradigm??
 
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The benefit of using POJOs is being decoupled from the EJB API and from the requirement of running in an EJB Container. Testing is just one of the side effects of that decoupling. The other big side effect is being freed from the heavyweight development process that EJB entails. This frees the developer to focus on business requirements instead of technology, which typically results in higher quality software that is better designed.
Of course, even though you can more easily Unit Test your POJOs, this does not mean that you do not test the EJB tier. You still need to write Acceptance Tests against the EJB tier to ensure that your software functions properly.
 
Tonny Tssagovic
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot Chris, You are a STAR
By the way, this might be a private question but can I ask you for how long time you have been programming in J2ee? In case I need a Guru like you in my new .com startup ... how much would I need to spare on other resources
 
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Tony,
I do not have much practical experience with EJB and POJOs.
If you have your business logic POJOs, do you still use EJBs for the transaction management(CMT) and persistences services(CMP)?
 
Tonny Tssagovic
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I am not an expert either, but one thing is for sure:
U can manage transactions in ur POJOs, and there is no need for EJBs.
U can have manage persistence as well without EJBs.
But if you want to take advanage of what EJBs have to offer, then you could as well have the Business logic in the POJOs and other stuff by the help of EJBs, but then these two parts will be tightly coupled.
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tonny Tssagovic:

But if you want to take advanage of what EJBs have to offer, then you could as well have the Business logic in the POJOs and other stuff by the help of EJBs, but then these two parts will be tightly coupled.


- Thanks Tonny,
But it is difficult to make this decision.Isn't it?....I do not know if I would use EJBs for sure, if I can have my POJOs done with transaction mngmt and persistence. Even though I am certified now with EJBs(SCBCD), I am not able to identify a project properly, where EJBs can be reasonably and effectively used . ...
Did I hear somebody say asynchonous messaging(MDBs)?
thanks,
[ February 09, 2004: Message edited by: Vish Kumar ]
 
Chris Mathews
Ranch Hand
Posts: 2713
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Tonny Tssagovic:
Thanks a lot Chris, You are a STAR
By the way, this might be a private question but can I ask you for how long time you have been programming in J2ee? In case I need a Guru like you in my new .com startup ... how much would I need to spare on other resources


Thanks for the kind words. As for how long I have been at this... it has been a little over 4 years. Though, it seems like much longer than that .
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic