I would like users in an application to be able to access and edit their user profiles (Application A). The problem is that the user objects (entities, dao, beans) are handled in a separate application (Application B) which is specifically for managing user accounts. Importing the java sources for App B into App A could be messy and might need configuration of the persistence unit and connection. I'm thinking it would be better to inject an EJB from App B to App A to query the user DB and return the results so a user profile form is rendered in App A.
I know how to inject EJBs within the same application, but I'm not so sure about how it's done across different applications or even if that's the most advisable way to achieve what I want. Would really appreciate some advice on whether it's better practice to inject an external EJB into App A or simply import the classes from App B and use those. Thanks in advance!
App B (User App) Dao object is:
App B Service
App B bean:
The page I would like to render in App A is something like this:
Actually, the original EJB spec was designed specifically for uses like that. It uses the Java remote method call interface.
In practice, setting all that up was cumbersome and resource-expensive, so over time, EJBs became lighter and lighter, since in many cases, they didn't need remote access like you do.
So the answer is that you implement your EJBs with remote interfaces instead of (or in addition to) local ones.
Details on remote EJBs are something better asked about in our EJB forum. There's nothing JSF-specific about them.
However, I do recommend that if you go that route that you don't host the code in a "half-stack" server like Tomcat or JeTTy. Full-stack servers such as JBoss/Wildfly, WebSphere, WebLogic, and so forth have EJB support built into them, along with the necessary remoting services. The "half-stack" servers don't, so you'd have to add stuff to the applications themselves, and on top of that, it would be duplicated in each app that needed those functions.
"privilege" comes from the Latin words for "private" and "law" (legal) and dates to feudal times. To "claim privilege" meant that you were above the laws that applied to the common people.