P E N C I L
Login
JPA Basics
  1. Hibernate = JPA + more
  2. Access db with hibernate specific library  sessionFactory ( and HQL query, criteria, )
    Or with JPA: EntityManager (and JPQL)
  3. JPA specify in persistence.xml provider
    org.hibernate.ejb.HibernatePersistence
  4. JPA create:
    1. factory = Persistence.createEntityManagerFactory("PersistenceUnit");
      entityManager = factory.createEntityManager();
      EntityTransaction transaction = entityManager.getTransaction();
      entityManager.persist()
      transaction.commit():
    2. entityManager.createQuery().getResultList();
    3. entityManager.getCriteriaBuilder().createQuery().from(Person.class).where()