Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJB 3.0 JPA client jar

 
Max Alvarado
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34973
379
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic