use of com.orientechnologies.orient.core.entity.OEntityManager in project orientdb by orientechnologies.
the class OJPAPersistenceProvider method createContainerEntityManagerFactory.
@SuppressWarnings("unchecked")
@Override
public synchronized EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map map) {
OJPAProperties properties = ((info == null) ? new OJPAProperties() : (OJPAProperties) info.getProperties());
// Override parsed properties with user specified
if (map != null && !map.isEmpty()) {
properties.putAll(map);
}
// register entities from <class> tag
OEntityManager entityManager = getEntityManagerByDatabaseURL(properties.getURL());
entityManager.registerEntityClasses(info.getManagedClassNames());
return new OJPAEntityManagerFactory(properties);
}
use of com.orientechnologies.orient.core.entity.OEntityManager in project orientdb by orientechnologies.
the class OPersistentEmbeddedMapTest method setup.
@BeforeMethod
public void setup() {
final String url = "memory:tmpdb";
new OObjectDatabaseTx(url).create().close();
pool = new OPartitionedDatabasePool(url, "admin", "admin");
OObjectDatabaseTx db = new OObjectDatabaseTx(pool.acquire());
try {
db.setAutomaticSchemaGeneration(true);
OEntityManager entityManager = db.getEntityManager();
entityManager.registerEntityClass(Car.class);
entityManager.registerEntityClass(Person.class);
db.getMetadata().getSchema().synchronizeSchema();
} finally {
db.close();
}
}
Aggregations