Issue Details (XML | Word | Printable)

Key: NUCJPA-131
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Andy Jefferson
Reporter: Andy Jefferson
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.
DataNucleus API JPA

Provide way of dynamically creating persistence-unit and hence EMF

Created: 17/May/11 08:37 AM   Updated: 14/Jun/11 12:27 PM   Resolved: 17/May/11 08:48 AM
Component/s: None
Affects Version/s: None
Fix Version/s: 3.0.0.m5

Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 17/May/11 08:48 AM
SVN trunk allows the following

import org.datanucleus.metadata.PersistenceUnitMetaData;
import org.datanucleus.api.jpa.JPAEntityManagerFactory;


PersistenceUnitMetaData pumd = new PersistenceUnitMetaData("dynamic-unit", "RESOURCE_LOCAL", null);
pumd.addProperty("javax.persistence.jdbc.driver", "org.hsqldb.jdbcDriver");
pumd.addProperty("javax.persistence.jdbc.url", "jdbc:hsqldb:mem:nucleus");
pumd.addProperty("javax.persistence.jdbc.user", "sa");
pumd.addProperty("javax.persistence.jdbc.password", "");
pumd.addProperty("datanucleus.autoCreateSchema", "true");

EntityManagerFactory emf = new JPAEntityManagerFactory(pumd, null);