• 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:

Newbie question - how to include dependent classes automatically in ejb jar

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Experts,

I have a basic question.
I am using Jdeveloper 11g and have divided my application into 2 projects (Model(ejb's) and Viewcontroller(jsf+managed beans etc)).
The model project has a stateless session bean(named VisitingScholarBean) which uses a backing bean class(named VisitingScholarDetails) defined in the ViewController project.
The relevant Method in the stateless session bean is public void saveVSDetails(VisitingScholarDetails vsDetails).
Now the issue is that the VisitingScholarDetails class is part of only the ViewController project.
So when I try to run the application it gives an error saying that


I cannot replicate the same VisitingScholarDetails class in both projects.
Please let me know how to include the VisitingScholarDetails class in the ejb-jar without replicating it in the Model and View Controller projects.
Thanks for your time and help.

Regards
Kiran
 
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are two things you could do.

* I have not used JDeveloper but, adding the controller project as a dependency in the EJB project should remove the problem. You EAR should be exported with the relevant dependencies.

* Make a jar of the controller project and put it in the lib of the ejb project.

The gist of your question is 'How do you ensure shared classes are available to both apps' correct ? If the solution does not make sense or your problem is different, feel free to reply with additional information
 
Kiran Srinivasa
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot , Deepak. Setting the dependencies of the View Controller in the Model helped.
However I had one more question. When I build in the ejb -jar should I include the view controller classes also?
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

When I build in the ejb -jar should I include the view controller classes also?



If the EJB classes have a dependency then yes.

The way I see it, your EJB project should have this class to begin with. This class is a Value Object, which might be used in several applications. The definition of the input and output objects of an EJB call should be within the project. It is not normal to have API classes defined in other projects. Think about that if you are yet to deploy this application in prod.
 
Kiran Srinivasa
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Deepak.
However it comes back to my basic question. The Value Object is used in both the EJB as well as the EJB client(in this case a JSF managed bean).
It is not however possible to define it in both places. In my case I have the jsf managed bean(VisitingScholarDetails) itself as the VO for the EJB. Is it a good practice to define the VO in the web tier or should we define it in the EJB tier and reuse it in the web?

Regards
Kiran
 
Deepak Bala
Bartender
Posts: 6663
5
MyEclipse IDE Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Is it a good practice to define the VO in the web tier or should we define it in the EJB tier and reuse it in the web?



Define the VO in the EJB project since you are going to reuse it in other projects. The VO is part of the EJB business API parameters / return value. It belongs in the EJB project.
 
Kiran Srinivasa
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot for clarifying my doubts, Deepak. It was a pleasure interacting with you.
 
reply
    Bookmark Topic Watch Topic
  • New Topic