Are Remote EJBs the right way to go?

I am planning to remodel my current application and I am not sure if this is the right approach.

Currently
I have a Java Enterprise server application with 3 web-applications and an ejb-application which handles the database (JPA with EJB-Facades). Everything in one single project (deployed as an ear file).
The web-applications are quite independent, though they all use the same database and the same entities. So, they all depend on the ejb-application.

What I would like to do
I would like to separate the web-applications, so they can run independently and I don’t need to redeploy everything, only because I make a change in one application.

The idea is to create a single jar library that contains remote interfaces for the existing facade beans. That way I can setup the jar to be a server wide available library and deploy my ejb-application that then will implement the remote interfaces.
The 3 web-applications would only have to import my library and have full access to the database.

Now, I am not even sure if this is a recommendable way, since I guess the remote ejbs might have a serious impact on performance due to serialization (or don’t they ?).

And what about the database entity classes? Since every web-application uses them when accessing the database, they need to be in the jar as well. But having an ejb-application for database access that does not contain the actual entity classes – that just feels off.

 ————    ————    ————                
|web1|  |web2|  |web3|              
 ————    ————    ————                
          |   /                    
        ———————                         ———             ———
       |  JAR  |                       |EJB|——————————>|DB |
        ———————                         ———             ———
        entity classes <---import----- db-facades
        remote ejbs  <---implement---/

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *