Search in sources :

Example 1 with Category

use of ua.logos.orm2.entity.Category in project Logos_Materials_October_2017 by VolodymyrZavada.

the class App method main.

public static void main(String[] args) {
    EntityManagerFactory factory = Persistence.createEntityManagerFactory("mysql");
    EntityManager em = factory.createEntityManager();
    em.getTransaction().begin();
    Actor actor = new Actor("JENIFFER", "ANISTON", Gender.FEMALE, "FEBRUARY 11, 1969");
    em.persist(actor);
    Category category = new Category("ADVENTURE");
    em.persist(category);
    category = new Category("ACTION");
    em.persist(category);
    category = new Category("COMEDY");
    em.persist(category);
    category = new Category("HORROR");
    em.persist(category);
    em.getTransaction().commit();
    em.close();
    factory.close();
}
Also used : EntityManager(javax.persistence.EntityManager) Category(ua.logos.orm2.entity.Category) EntityManagerFactory(javax.persistence.EntityManagerFactory) Actor(ua.logos.orm2.entity.Actor)

Aggregations

EntityManager (javax.persistence.EntityManager)1 EntityManagerFactory (javax.persistence.EntityManagerFactory)1 Actor (ua.logos.orm2.entity.Actor)1 Category (ua.logos.orm2.entity.Category)1