use of javax.persistence.EntityManager in project hibernate-orm by hibernate.
the class NullProperties method addNewEntity.
private Integer addNewEntity(String str, long lng) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
BasicTestEntity1 bte1 = new BasicTestEntity1(str, lng);
em.persist(bte1);
em.getTransaction().commit();
return bte1.getId();
}
use of javax.persistence.EntityManager in project hibernate-orm by hibernate.
the class ImmutableClassAccessType method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
// Revision 1
em.getTransaction().begin();
country = Country.of(123, "Germany");
em.persist(country);
em.getTransaction().commit();
}
use of javax.persistence.EntityManager in project hibernate-orm by hibernate.
the class PropertyAccessType method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
em.getTransaction().begin();
PropertyAccessTypeEntity pate = new PropertyAccessTypeEntity("data");
em.persist(pate);
id1 = pate.getId();
em.getTransaction().commit();
em.getTransaction().begin();
pate = em.find(PropertyAccessTypeEntity.class, id1);
pate.writeData("data2");
em.getTransaction().commit();
}
use of javax.persistence.EntityManager in project hibernate-orm by hibernate.
the class AuditReaderAPITest method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
em.getTransaction().begin();
AuditedTestEntity ent1 = new AuditedTestEntity(1, "str1");
NotAuditedTestEntity ent2 = new NotAuditedTestEntity(1, "str1");
em.persist(ent1);
em.persist(ent2);
em.getTransaction().commit();
em.getTransaction().begin();
ent1 = em.find(AuditedTestEntity.class, 1);
ent2 = em.find(NotAuditedTestEntity.class, 1);
ent1.setStr1("str2");
ent2.setStr1("str2");
em.getTransaction().commit();
}
use of javax.persistence.EntityManager in project hibernate-orm by hibernate.
the class ColumnScalePrecisionTest method initData.
@Test
@Priority(10)
public void initData() {
EntityManager em = getEntityManager();
// Revision 1
em.getTransaction().begin();
ScalePrecisionEntity entity = new ScalePrecisionEntity(13.0);
em.persist(entity);
em.getTransaction().commit();
id = entity.getId();
auditTable = metadata().getEntityBinding("org.hibernate.envers.test.integration.basic.ScalePrecisionEntity_AUD").getTable();
originalTable = metadata().getEntityBinding("org.hibernate.envers.test.integration.basic.ScalePrecisionEntity").getTable();
}
Aggregations