Package javax.persistence

Examples of javax.persistence.EntityManagerFactory.createEntityManager()


        {
            return emf.createEntityManager();
        }
        else
        {
            return emf.createEntityManager( properties );
        }
    }

    /**
     * {@inheritDoc}
 
View Full Code Here


  }
 
  @Test
  public void findEntityManager() throws Exception {
    EntityManagerFactory emf = context().getService(EntityManagerFactory.class, "(&(osgi.unit.name=test-unit)(" + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true))");
    emf.createEntityManager();
  }
 
  @Test
  public void findEntityManager2() throws Exception {
    EntityManagerFactory emf = context().getService(EntityManagerFactory.class, "(&(osgi.unit.name=bp-test-unit)(" + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true))");
View Full Code Here

  }
 
  @Test
  public void findEntityManager2() throws Exception {
    EntityManagerFactory emf = context().getService(EntityManagerFactory.class, "(&(osgi.unit.name=bp-test-unit)(" + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true))");
    emf.createEntityManager();
  }

  @org.ops4j.pax.exam.junit.Configuration
  public static Option[] configuration() {
    return testOptions(
View Full Code Here

   
    EntityManagerFactory emf = context().getService(EntityManagerFactory.class,
        "(&(osgi.unit.name=dsf-test-unit)(" + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true))");
   
   
    EntityManager em = emf.createEntityManager();
   
    em.getTransaction().begin();
   
    Car c = new Car();
    c.setNumberPlate("123456");
View Full Code Here

   
    em.getTransaction().commit();
   
    em.close();
   
    em = emf.createEntityManager();
   
    assertEquals("blue", em.find(Car.class, "123456").getColour());
   
    reg.unregister();
   
View Full Code Here

   
    EntityManagerFactory emf = context().getService(EntityManagerFactory.class,
        "(&(osgi.unit.name=dsf-xa-test-unit)(" + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true))");
   
   
    EntityManager em = emf.createEntityManager();
   
    //Use a JTA tran to show integration
    UserTransaction ut = context().getService(UserTransaction.class);
   
    ut.begin();
View Full Code Here

   
    ut.commit();
     
    em.close();
   
    em = emf.createEntityManager();
   
    assertEquals("blue", em.find(Car.class, "123456").getColour());
   
    reg.unregister();
   
View Full Code Here

    //Set up a transaction so we can check the Quiesce waits properly
    UserTransaction tm = context().getService(UserTransaction.class);
   
    tm.begin();
   
    emf.createEntityManager().getProperties();
   
    QuiesceParticipant participant = getParticipant("org.apache.aries.jpa.container.context");
   
    TestQuiesceCallback callback = new TestQuiesceCallback();
   
View Full Code Here

        + PersistenceUnitConstants.CONTAINER_MANAGED_PERSISTENCE_UNIT + "=true)" +
      "(" + PersistenceContextProvider.PROXY_FACTORY_EMF_ATTRIBUTE + "=*))");
   
    tm.begin();
   
    emf.createEntityManager().getProperties();
   
    tm.commit();
   
    Thread.sleep(1000);
   
View Full Code Here

   
    //Test again to make sure we don't hold state over
   
    tm.begin();
   
    emf.createEntityManager().getProperties();
   
    callback = new TestQuiesceCallback();
   
    participant.quiesce(callback, Collections.singletonList(context().getBundleByName(
        "org.apache.aries.jpa.org.apache.aries.jpa.container.itest.bundle")));
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.