Examples of createEntityManager()


Examples of javax.persistence.EntityManagerFactory.createEntityManager()

                EntityManager entityManager = entityManagerRegistry.getInheritedEntityManager(entityManagerFactory);
                if (entityManager == null) {
                    if (properties != null) {
                        entityManager = entityManagerFactory.createEntityManager(properties);
                    } else {
                        entityManager = entityManagerFactory.createEntityManager();
                    }
                }
                entityManagers.put(entityManagerFactory, entityManager);
            }
        }
View Full Code Here

Examples of javax.persistence.EntityManagerFactory.createEntityManager()

      assertEquals(cs.size(), 0);
      assertFalse(cs.contains(obj1.getKey()));
      assertFalse(cs.contains(obj1.getKey()));
     
      EntityManagerFactory emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
      EntityManager em = emf.createEntityManager();     
      EntityTransaction txn = em.getTransaction();
      txn.begin();
      em.persist(obj1.getValue());
      em.persist(obj2.getValue());
      em.flush();
View Full Code Here

Examples of javax.persistence.EntityManagerFactory.createEntityManager()

      assertEquals(cs.size(), 2);
      assertTrue(cs.contains(obj1.getKey()));
      assertTrue(cs.contains(obj1.getKey()));
     
      EntityManagerFactory emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);
      EntityManager em = emf.createEntityManager();     
     
      assertEquals(em.find(obj1.getValue().getClass(), obj1.getKey()), obj1.getValue());
      assertEquals(em.find(obj2.getValue().getClass(), obj2.getKey()), obj2.getValue());
     
      em.close();
View Full Code Here

Examples of javax.persistence.EntityManagerFactory.createEntityManager()

    factory = Persistence.createEntityManagerFactory( "manager1" );
  }

  public void testDefaultPar() throws Exception {
    EntityManagerFactory emf = Persistence.createEntityManagerFactory( "defaultpar", new HashMap() );
    EntityManager em = emf.createEntityManager();
    ApplicationServer as = new ApplicationServer();
    as.setName( "JBoss AS" );
    Version v = new Version();
    v.setMajor( 4 );
    v.setMinor( 0 );
View Full Code Here

Examples of javax.persistence.EntityManagerFactory.createEntityManager()

  public void testListenersDefaultPar() throws Exception {
    IncrementListener.reset();
    OtherIncrementListener.reset();
    EntityManagerFactory emf = Persistence.createEntityManagerFactory( "defaultpar", new HashMap() );
    EntityManager em = emf.createEntityManager();
    em.getTransaction().begin();
    ApplicationServer as = new ApplicationServer();
    as.setName( "JBoss AS" );
    Version v = new Version();
    v.setMajor( 4 );
View Full Code Here

Examples of javax.persistence.EntityManagerFactory.createEntityManager()

    emf.close();
  }

  public void testExplodedPar() throws Exception {
    EntityManagerFactory emf = Persistence.createEntityManagerFactory( "explodedpar", new HashMap() );
    EntityManager em = emf.createEntityManager();
    org.hibernate.ejb.test.pack.explodedpar.Carpet carpet = new Carpet();
    Elephant el = new Elephant();
    el.setName( "Dumbo" );
    carpet.setCountry( "Turkey" );
    em.getTransaction().begin();
View Full Code Here

Examples of javax.persistence.EntityManagerFactory.createEntityManager()

      nested = nested.getCause();
      if ( nested == null ) throw e;
      if ( ! ( nested instanceof ClassNotFoundException ) ) throw e;
      fail( "Try to process hbm file: " + e.getMessage() );
    }
    EntityManager em = emf.createEntityManager();
    Caipirinha s = new Caipirinha( "Strong" );
    em.getTransaction().begin();
    em.persist( s );
    em.getTransaction().commit();
View Full Code Here

Examples of javax.persistence.EntityManagerFactory.createEntityManager()

    emf.close();
  }

  public void testCfgXmlPar() throws Exception {
    EntityManagerFactory emf = Persistence.createEntityManagerFactory( "cfgxmlpar", new HashMap() );
    EntityManager em = emf.createEntityManager();
    Item i = new Item();
    i.setDescr( "Blah" );
    i.setName( "factory" );
    Morito m = new Morito();
    m.setPower( "SuperStrong" );
View Full Code Here

Examples of javax.persistence.EntityManagerFactory.createEntityManager()

    emf.close();
  }

  public void testSpacePar() throws Exception {
    EntityManagerFactory emf = Persistence.createEntityManagerFactory( "space par", new HashMap() );
    EntityManager em = emf.createEntityManager();
    Bug bug = new Bug();
    bug.setSubject( "Spaces in directory name don't play well on Windows");
    em.getTransaction().begin();
    em.persist( bug );
    em.flush();
View Full Code Here

Examples of org.apache.openjpa.persistence.OpenJPAEntityManagerFactory.createEntityManager()

        pmfSPI
            .addLifecycleListener(listener, new Class[]{ RuntimeTest4.class });

        try {
            BrokerImpl broker = (BrokerImpl) JPAFacadeHelper.toBroker
                (pmf.createEntityManager());
            MetaDataRepository repos = broker.getConfiguration().
                getMetaDataRepositoryInstance();
            assertTrue("no listeners defined added to Runtimetest4",
                broker.getLifecycleEventManager().hasLoadListeners(
                    new RuntimeTest4("foo"),
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.