// Collection of code snippets by Arne Vajhøj 
// (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
import java.util.logging.Level;
import java.util.logging.Logger;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.TypedQuery;

public class InsertAfter6 {
    public static void main(String[] args) throws Exception {
        Logger.getLogger("org.hibernate").setLevel(Level.OFF);
        EntityManagerFactory emf = Persistence.createEntityManagerFactory("Address");
        EntityManager em = emf.createEntityManager();
        em.getTransaction().begin();
        AddressJPA addr;
        addr = new AddressJPA(15, "O O", "O Road 1515");
        em.persist(addr);
        addr = new AddressJPA(16, "P P", "P Road 1616");
        em.persist(addr);
        em.getTransaction().commit();
        em.close();
        emf.close();
    }
}
