0

In a project (war), I am using an EntityManager defined using a persistence unit. The definition of this persistence unit is made in a library that is packed as jar and installed on in Glassfish's libs. This lib is not included in the war.

Since I am using the persistence-unit defined in the library's persistence.xml, I have to copy it into my project.

I prefer not having to do this. Is there a way, such that I don't need to copy this persistence.xml and just reference it somehow in the library or anything like that?

Mike de Dood
  • 393
  • 1
  • 10
  • have a look at this, im not sure how you can use it but it might be useful to you: http://docs.spring.io/spring/docs/3.1.x/javadoc-api/org/springframework/orm/jpa/LocalContainerEntityManagerFactoryBean.html#setPersistenceUnitManager(org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager) – ConMan Jul 02 '14 at 14:13
  • 1
    I asked [something similar](http://stackoverflow.com/questions/6679309/how-to-layout-java-ee-projects-using-common-jpa-entities) myself. – Alexander Rühl Jul 02 '14 at 14:35
  • @ConMan Currently I don't have a dependency on Spring and would like to keep it that way. – Mike de Dood Jul 02 '14 at 14:47

0 Answers0