EntityManagerProvider { public static EntityManager getEntityManager() { return ENTITY_MANAGER_FACTORY.createEntityManager(); }  static void init(); static T persist(final T t); @SuppressWarnings("unchecked") static List<T> find(final String query); static EntityManager getEntityManager();  }
@Test public void createEntity() { final EntityManager entityManager = EntityManagerProvider.getEntityManager(); final EntityTransaction transaction = entityManager.getTransaction(); JPAContext jpaContext = JPAContextFactory.newInstance(Database.POSTGRES, entityManager) .generate(); transaction.begin(); final ResultMap persist = jpaContext.createAndPersist(Entity.of(Sample.class)); transaction.commit(); final Sample sample = persist.get(Sample.class); System.out.println(sample.getId()); System.out.println(sample.getName()); }