I found part of the solution ...
In persistence.xml file you can define a list of additional classes for a persistence unit thanks to class tag. Something like this :
Code:
<persistence-unit name="t4Seam">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/jdbc/t4Seam</jta-data-source>
<class>t4.core.utils.process.internal.Process</class>
<class>t4.core.utils.process.internal.ProcessFeature</class>
<class>t4.core.utils.process.internal.ProcessSetting</class>
<class>t4.core.utils.process.internal.ProcessTemplate</class>
<class>t4.core.utils.right.internal.Role</class>
<class>t4.core.utils.right.internal.ProcessRight</class>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="false"/>
</properties>
</persistence-unit>
Then you just have to add the jars containing theses classes to the classpath then it works.
Problem is that it's not a very good solution from a maintenance point of view : if I add new entities to the other jar, I will have to add them by hand in persistence.xml to ensure they are known by my persistence unit. So what I need is to tell Hibernate to scan a jar to retrieve EJB3 entities. For what I understood, this is what jar-file is made for. So I changed my persistence.xml file this way :
Code:
<persistence-unit name="t4Seam">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/jdbc/t4Seam</jta-data-source>
<jar-file>t4-core-utils-core-1.0-SNAPSHOT.jar</jar-file>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="false"/>
</properties>
</persistence-unit>
But I can't make it work ... It can't find my jar and I have no idea how to solve this. The easiest way would be that Hibernate scans for classpath, but it looks this is not the case : it uses a relative path to retrieve the jar. The problem is that I use Maven to manage depencencies for my project and so I can't access the jar using a relative path ... Anyone has an idea how I could do this ? Is there a way to tell Hibernate that it should look for the jar in classpath ?
Thanks in advance
Merci d'avance ;)