Reputation: 13111
We have 2 modules which we would like to run as 2 different war applications.
(e.g. app-common.jar containing common classes like User ... app-module1.jar provides module1 functionality and has a dependency on app-common.jar app-module2.jar provides module2 functionality and has a dependency on app-common.jar)
app-module1.war will be deployed on machine1:port1 and app-module2.war will be deployed on machine2:port2.
but the underlying database will be the same for both the web applications.
When we use JPA in dev mode, there seems to issue with SQL creation as both the application causes the common classes to be dropped and created.
How do I avoid that?
Upvotes: 0
Views: 183
Reputation: 4273
Either don't let the application drop and recreate the database. In persistence.xml, change
<property name="hibernate.hbm2ddl.auto" value="create" />
to
<property name="hibernate.hbm2ddl.auto" value="validate" />
or even to "none". Or, since you are in dev mode, use different databases by providing each application with its own datasource definition.
Upvotes: 1