剛剛看到DataNucleus文檔中:
import org.datanucleus.metadata.PersistenceUnitMetaData;
import org.datanucleus.api.jpa.JPAEntityManagerFactory;
PersistenceUnitMetaData pumd = new PersistenceUnitMetaData("dynamic-unit", "RESOURCE_LOCAL", null);
pumd.addClassName("org.datanucleus.test.A");
pumd.setExcludeUnlistedClasses();
pumd.addProperty("javax.persistence.jdbc.url", "jdbc:h2:mem:nucleus");
pumd.addProperty("javax.persistence.jdbc.driver", "org.h2.Driver");
pumd.addProperty("javax.persistence.jdbc.user", "sa");
pumd.addProperty("javax.persistence.jdbc.password", "");
pumd.addProperty("datanucleus.autoCreateSchema", "true");
EntityManagerFactory emf = new JPAEntityManagerFactory(pumd, null);
http://www.datanucleus.org/products/accessplatform_3_2/jpa/persistence_unit.html
感謝您的答覆,祝你歸類PersistenceUnitInfo接口實現需要在createContain中傳遞的類erEntityManagerFactory()方法。 –
Hello James Sutherland,您可以爲實現類PersistenceUnitInfo提供方向/示例鏈接,它需要在createContainerEntityManagerFactory()方法中作爲參數傳遞(包含持久性單元信息) –
檢查JPA規範,它應該覆蓋PersistecneUnitInfo規範 – James