Search in sources :

Example 1 with Person

use of com.company.app.model.Person in project microservices by pwillhan.

the class App method entityManager.

private static void entityManager() {
    final EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("test");
    final EntityManager entityManager = entityManagerFactory.createEntityManager();
    final Person person = new Person();
    person.setName("Dick");
    entityManager.getTransaction().begin();
    entityManager.persist(person);
    entityManager.getTransaction().commit();
    entityManager.close();
    entityManagerFactory.close();
}
Also used : EntityManager(javax.persistence.EntityManager) EntityManagerFactory(javax.persistence.EntityManagerFactory) Person(com.company.app.model.Person)

Aggregations

Person (com.company.app.model.Person)1 EntityManager (javax.persistence.EntityManager)1 EntityManagerFactory (javax.persistence.EntityManagerFactory)1