This week's book giveaway is in the OCAJP forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide 1Z0-808 and have Jeanne Boyarsky & Scott Selikoff on-line! See this thread for details.
I have an EJB3 for a JPA project. I have my entity, as well as the facade, and a remote interface for the bean. I have a need to create a separated EJB client jar project, so I can give it to another team of developers. If this were not a JPA EJB3, I could just give them a jar with the remote Interface. However, this remote interface makes reference to the DB entity. What is the standard practice in these cases? Should I make the entities part of the EJB client project instead of the EJB project?
Please let me know what you think...
In EJB 2.X, it was possible to create remote interfaces for entity beans and have clients call them directly. However, it was an anti-pattern. The preferred approach was to create a session bean and use that as a facade. The session bean would have a remote interface and the entity beans would be called (from the session bean) via local interfaces.
In EJB 3/JPA, they finally got rid of the rope to hang yourself. It is not possible to make remote calls from JPA. You can still create a session bean for remote calls as a session facade though. The client jar contains the remote interface for the session bean. The session bean then calls the JPA.