Question

The presentation tier will contain 2 web modules (serving different purposes and based on different technologies), the middle tier will be Spring beans without EJBs and the persistence tier will be JPA on Hibernate. I am wondering what would be the best project setup in this case. The IDE I am planning to use is MyEclipse 8.5. Thanks.

Was it helpful?

Solution

One Java project for the common stuff that's packaged as a JAR file.

Two web projects, each packaged in their own WAR file, that accept the common JAR file as a 3rd party dependency.

Do I need an EAR?

You can do that if you're using a Java EE app server like WebLogic, JBOSS, Glassfish, Geronimo, or WebSphere. An EAR won't be an option if you're using a servlet/JSP engine like Tomcat or Jetty to deploy.

Or just 3 separate projects?

Three projects will have the advantage of looser coupling. Your two web apps are coupled at the common JAR and database levels, but from a deployment point of view you can alter the rest for one and not affect the other.

What can be put into the common JAR? What I can think of is JPA entities, DAOs.

Everything that's shared except for the web tier stuff.

What if 2 WARs try to access the same data at the same time?

That has to do with isolation, table locking, and the design of the application.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top