Where I work it is a common practice to create a separate for JPA entities and a project for the web application (the WAR). So basically you have (at least) two project for each application - appJPA and appWEB.

The people who started this convention are no longer there, so I have been wondering about the benefit of having this separation. The only advantage I could think about is the Eclipse JPA facet which provides various tools for JPA. But if I am not mistaken, this facet can be applied to WAR projects as well.

So my question is: is this separation unnecessary?


For big to mid level web projects, it is a good practice to separate your domain(model) from your presentational logic(view). You can go one step further and have an additional layer in between wherein business logic is placed (controller). This is a fairly common pattern in developing web applications known as MVC:


It helps adhering to the


Where each layer is responsible for doing its own thing, and with as little dependency on other layers as possible. For example, your domain (beans and such) most of the time doesn't need to know much about the business logic that operates on top of it:


This will help in refactoring, code maintenance and separation of concerns.

What JPA does for you is it gives you a common way of dealing with persistence, which is well known by most JEE developers. What support Eclipse provides and how JPA beans are packaged is mostly irrelevant as to why the developers choose to separate those projects, but that, of course, comes as a plus.

I think the developers that were working in your company were more concerned about following design patterns, separation of concerns, ease of maintenance when they made their decisions, rather than IDE support and packaging problems. And I also think you should stick with their decision, unless you are developing a very small project and in a very short time and you don't care about the benefits of having separate projects that I listed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.