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.
* 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
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?
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.
Joined: Jul 07, 2009
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?