0

Im using hibernate.hbm2ddl.auto=validate in my persistence.xml. But the problem I have is my project connects to multiple databases using multiple data sources.

So when I turn on validation then it will try to find out tables in wrong databases since they are annotated as tables. Is there any way to specify which tables each validator should look into ? following is the part of persistence.xml I have

  <persistence-unit name="primary">
    <jta-data-source>java:jboss/datasources/oneDataSource</jta-data-source>
    <shared-cache-mode>DISABLE_SELECTIVE</shared-cache-mode>
    <properties>
      <property name="hibernate.hbm2ddl.auto" value="validate"/>
    </properties>
  </persistence-unit>
  <persistence-unit name="mymysql">
    <jta-data-source>java:jboss/datasources/twoDataSource</jta-data-source>
    <shared-cache-mode>DISABLE_SELECTIVE</shared-cache-mode>
    <properties>
      <property name="hibernate.hbm2ddl.auto" value="validate"/>
    </properties>
  </persistence-unit>
Gimby
  • 5,095
  • 2
  • 35
  • 47
dinesh707
  • 12,106
  • 22
  • 84
  • 134
  • As far as I can see your problem is more global than only the validation; the entities you have are being mapped in both persistence units. As such I do believe that this is relevant to you: http://stackoverflow.com/questions/16204565/jpa-entity-specify-persistence-unit – Gimby Nov 17 '15 at 10:34
  • Looks promising. I'll try – dinesh707 Nov 17 '15 at 10:36

0 Answers0