Package de.mhus.lib.jpa

Examples of de.mhus.lib.jpa.JpaEntityManager.commit()


   
    Book book2 = new Book();
    book2.setName("Sofies Welt");
    em.persist(book2);
   
    em.commit();
   
    System.out.println("ID: " + book1.getId() );
    System.out.println("ID: " + book2.getId() );
   
    assertNotSame(book1.getId(), book2.getId());
View Full Code Here


   
    Person p2 = em.injectObject(new Person());
    p2.setName("Lola Langohr");
    p2.save();
   
    em.commit();
   
    {
      JpaQuery<Person> query = em.createQuery("select p from Person p", Person.class);
      List<Person> list = query.getResultList();
      assertTrue(list.size() == 2);
View Full Code Here

      }
    }
   
    em.begin();
    p2.remove();
    em.commit();
   
    {
      JpaQuery<Person> query = em.createQuery("select p from Person p", Person.class);
      List<Person> list = query.getResultList();
      assertTrue(list.size() == 1);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.