| Author |
EJB 3.0 JPA client jar
|
Max Alvarado
Greenhorn
Joined: Apr 26, 2010
Posts: 1
|
|
Hi,
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...
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26218
|
|
Max,
Welcome to JavaRanch!
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.
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26218
|
|
|
And, no you shouldn't distribute the JPA. The database still lives on your server. The callers would have no use for the JPA since they would not have database access. Nor should they.
|
 |
 |
|
|
subject: EJB 3.0 JPA client jar
|
|
|