Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB jar dependency in the web project  RSS feed

 
AmitKumar Dutta
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have this situation. I have a ejbproject, a web project and a application project. Now I want to design a decoupled environment where Web is completely independent of ejb project. Web will only have refrence of the ejb stubs nothing else (domain objet etc..)
So far in the current system domain objects are directly getting used in the jsps. I know if I create value objects it will provide a loose coupling. following are my questions
1) Where should I place my value objects? in ejb or in web? If I put it in ejb then I have to provide reference of the ejb project in the web which contradicts ejb concept(is it correct?).
2) My understanding is on each request value objects will get populated. Thru business deligate we will call a ejb operation. then ejb will return a domain object. through domain object we will populate the value objects. But where at ejb or at web?
3) What is the best practice in such situation?

My solution is create a common jar and put the value objects in the common jar. use the common jar in both. Am I in correct path?

Thanks Amit
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37230
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amit,
Yes, a common jar is best. If you are making local ejb calls, having the web project refer to the ejb project is also a valid option.
 
Praneeth Yeri
Greenhorn
Posts: 11
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We had a very similar situation in one of our projects and we did the following.

1. Presentation tier ( Web Project) team developed their own Presentation Layer Objects ( Value Objects). The value objects live in a presentationVOs.jar and is used only by the Web Project.

2. EJB Tier (Actually it was Web service tier in our Project) team developed their own Domain Objects. They packaged them into ServiceDomainObjs.jar.

The EJBs were supposed to be enterprise wide reusable components,

Hence the Presentation team wrote an Adapter class which was put in a Common Jar. The adapter class had utility methods that would take only the Domain Objects and conver them into Presentation Tire Value Objects. This was put in a Common Jar, so that if any Presentation Tier project needs similar conversion, this adapter can be reused.

The Adapter should be called from the Presentation Tier only, as the EJBs are supposed to be Enterprise Reusable.
 
AmitKumar Dutta
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeanne and Praneeth for the input.
But is it ok If I use ejb project reference in the web. Does it contradict ejb usage.

Thanks
Amit
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37230
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
AmitKumar Dutta wrote:Thanks Jeanne and Praneeth for the input.
But is it ok If I use ejb project reference in the web. Does it contradict ejb usage.

No.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37230
519
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry - I should be clearer. No, it does not contradict EJB usage.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!