use of org.jpwh.model.complexschemas.naturalprimarykey.User in project microservices by pwillhan.
the class NaturalPrimaryKey method storeLoad.
@Test
public void storeLoad() throws Exception {
UserTransaction tx = TM.getUserTransaction();
try {
tx.begin();
EntityManager em = JPA.createEntityManager();
{
User user = new User("johndoe");
em.persist(user);
}
tx.commit();
em.close();
tx.begin();
em = JPA.createEntityManager();
{
User user = em.find(User.class, "johndoe");
assertNotNull(user);
}
tx.commit();
em.close();
} finally {
TM.rollback();
}
}
Aggregations