I've a credit card applicatoin which handles 3 databases. I personally use hibernate with JPA on seam framework.

So I've got a persitence.xml file with three persitence-unit such as this (I remove qualities for db2 and db3):

<persistence-unit name="db1" transaction-type="JTA" >
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <jta-data-source>db1source</jta-data-source>
    <properties>
        <property name="hibernate.dialect"
            value="org.hibernate.dialect.Oracle10gDialect" />
        <property name="hibernate.connection.driver_class"
            value="oracle.jdbc.driver.OracleDriver" />
        <property name="hibernate.hbm2ddl.auto" value="validate" />
        <property name="hibernate.show_sql" value="false" />
        <property name="hibernate.format_sql" value="true" />
        <property name="hibernate.default_schema" value="SI_TEC" />
        <property name="hibernate.validator.apply_to_ddl" value="false" />
        <property name="hibernate.transaction.manager_lookup_class"
            value="org.hibernate.transaction.WeblogicTransactionManagerLookup" />
    </properties>
</persistence-unit>

<persistence-unit name="db2" transaction-type="JTA">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <jta-data-source>d2source</jta-data-source>
</persistence-unit>

<persistence-unit name="db3" transaction-type="JTA">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <jta-data-source>d3source</jta-data-source>
</persistence-unit>

During my seam components.xml file, I create 3 handled-persistence-context to map seam with my hibernate configuration.

Finally, I've several organizations and my issue is here. I have to persist some organizations in db2 along with other in db3. So database schema will vary so when I deploy my application, I recieve this error:

org.hibernate.HibernateException: Missing table: PORTAILPERMISSION
    at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1113)
    at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:139)
    at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:349)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
    at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:867)
    Truncated. see log file for complete stacktrace

Because, the table PORTAILPERMISSION does not appear in db2.

My real question is:

How you can specify in entity class what database (or persitence-unit) can be used to validate entity in startup ?

Interesting help.

You attempt to clearly list classes (<class>..</class>) in every persistence unit. And employ

<exclude-unlisted-classes>true</exclude-unlisted-classes>