Wildfly 10 hibernate properties being shared among multiple applications -
we have 2 independent applications app1 , app2 deployed on wildfly 10 server(as separate .war files) , both using 'org.hibernate' module wildfly. ideally, both application should connecting 2 separate databases.
each of these applications has own hibernate.properties within respective classpaths.
issue
the first application app1 deployed configured correctly use database, second application app2 when deployed, uses hibernate properties first application , connects app1's db.
it seems, wildfly initializes hibernate module first hibernate.properties found , uses other applications deployed on server.
any suggestion on how both applications can configured connect own db or pointers on how hibernate module loading works multiple applications in wildfly helpful.
in wildfly not supposed use hibernate directly. instead should use jpa-api described here.
this means using entitymanager injected code:
@persistencecontext(unitname = "customerpu") entitymanager em; the value unitname references name of data source configured in standalone.xml. if not using dependency injection, can bind entitymanager jndi entry, explained here.
hence can define 2 different data sources in standalone.xml , inject in both applications 2 different entity managers.
Comments
Post a Comment