Original intention of this task is to bootstrapping JPA app in Java SE envrionement with with Persistence.createEntityManagerFactory(String persistenceUnitName, Map properties) or Persistence.generateSchema(String persistenceUnitName, Map properties) with an inexistent peristent unit, say the persistence unit with the given persistenceUnitName is thought to be generated when invoking those methods mentioned above
Conclusion
But my thought is wrong since JPA spec stated:
A persistence unit is defined by a persistence.xml file
=> the easiest way should be to keep the META-INF/persistence.xml in the jar so that there is at least an existing persistence unit with a defined persistence provider and other properties can be replaced by the Map properties in Persistence.createEntityManagerFactory(String persistenceUnitName, Map properties) and Persistence.generateSchema(String persistenceUnitName, Map properties)
Original intention of this task is to bootstrapping JPA app in Java SE envrionement with with
Persistence.createEntityManagerFactory(String persistenceUnitName, Map properties)
orPersistence.generateSchema(String persistenceUnitName, Map properties)
with an inexistent peristent unit, say the persistence unit with the givenpersistenceUnitName
is thought to be generated when invoking those methods mentioned aboveConclusion
But my thought is wrong since JPA spec stated:
=> the easiest way should be to keep the
META-INF/persistence.xml
in the jar so that there is at least an existing persistence unit with a defined persistence provider and other properties can be replaced by theMap properties
inPersistence.createEntityManagerFactory(String persistenceUnitName, Map properties)
andPersistence.generateSchema(String persistenceUnitName, Map properties)