Examples of createEntityManager()


Examples of javax.persistence.EntityManagerFactory.createEntityManager()

    final EntityManagerFactory emf = Persistence.createEntityManagerFactory( "jpajtastandalone", TestHelper.getEnvironmentProperties() );

    TransactionManager transactionManager = extractJBossTransactionManager( emf );

    transactionManager.begin();
    final EntityManager em = emf.createEntityManager();
    Hero h = new Hero();
    h.setName( "Spartacus" );
    em.persist( h );
    SuperHero sh = new SuperHero();
    sh.setName( "Batman" );
View Full Code Here

Examples of javax.persistence.EntityManagerFactory.createEntityManager()

    final EntityManagerFactory emf = Persistence.createEntityManagerFactory( "jpajtastandalone",
        TestHelper.getEnvironmentProperties() );
    TransactionManager tm = extractJBossTransactionManager( emf );

    tm.begin();
    final EntityManager em = emf.createEntityManager();
    CommunityMember member = new CommunityMember( "Davide" );
    em.persist( member );

    Employee employee = new Employee( "Alex", "EMPLOYER" );
    em.persist( employee );
View Full Code Here

Examples of javax.persistence.EntityManagerFactory.createEntityManager()

   public EntityManager create(Bean<EntityManager> bean, CreationalContext<EntityManager> arg0)
   {
      try
      {
         EntityManagerFactory emf = getEntityManagerFactory();
         EntityManager entityManager = emf.createEntityManager();
         entityManager = getPersistenceProvider(entityManager).proxyEntityManager(entityManager);
         PersistenceContexts persistenceContexts = null;
         try
         {
            persistenceContexts = getPersistenceContexts();
View Full Code Here

Examples of javax.persistence.EntityManagerFactory.createEntityManager()

    public void testEndToEnd() {
        // make sure we can get things fully instantiated
        EntityManagerFactory emf = createEMF(A.class, B.class, C.class,
            AbstractThing.class);
        emf.createEntityManager().close();
        emf.close();
    }
}
View Full Code Here

Examples of javax.persistence.EntityManagerFactory.createEntityManager()

        EntityManagerFactory emf = persistenceProvider.createContainerEntityManagerFactory(unitInfo, properties);

        if (unitInfo.getNonJtaDataSource() != null) {
            final ImportSql importer = new ImportSql(appClassLoader, unitInfo.getPersistenceUnitName(), unitInfo.getNonJtaDataSource());
            if (importer.hasSomethingToImport()) {
                emf.createEntityManager().close(); // to let OpenJPA create the database if configured this way
                importer.doImport();
            }
        }

        return emf;
View Full Code Here

Examples of javax.persistence.EntityManagerFactory.createEntityManager()

                JtaEntityManagerRegistry.EntityManagerTracker entityManagerTracker = entityManagerRegistry.getInheritedEntityManager(entityManagerFactory);
                EntityManager entityManager;
                if (entityManagerTracker == null) {
                    if (properties != null) {
                        entityManager = entityManagerFactory.createEntityManager(properties);
                    } else {
                        entityManager = entityManagerFactory.createEntityManager();
                    }
                    entityManagerTracker = new JtaEntityManagerRegistry.EntityManagerTracker(entityManager);
                } else {
View Full Code Here

Examples of javax.persistence.EntityManagerFactory.createEntityManager()

                EntityManager entityManager;
                if (entityManagerTracker == null) {
                    if (properties != null) {
                        entityManager = entityManagerFactory.createEntityManager(properties);
                    } else {
                        entityManager = entityManagerFactory.createEntityManager();
                    }
                    entityManagerTracker = new JtaEntityManagerRegistry.EntityManagerTracker(entityManager);
                } else {
                    entityManagerTracker.incCounter();
                }
View Full Code Here

Examples of javax.persistence.EntityManagerFactory.createEntityManager()

                JtaEntityManagerRegistry.EntityManagerTracker entityManagerTracker = entityManagerRegistry.getInheritedEntityManager(entityManagerFactory);
                EntityManager entityManager;
                if (entityManagerTracker == null) {
                    if (properties != null) {
                        entityManager = entityManagerFactory.createEntityManager(properties);
                    } else {
                        entityManager = entityManagerFactory.createEntityManager();
                    }
                    entityManagerTracker = new JtaEntityManagerRegistry.EntityManagerTracker(entityManager);
                } else {
View Full Code Here

Examples of javax.persistence.EntityManagerFactory.createEntityManager()

                EntityManager entityManager;
                if (entityManagerTracker == null) {
                    if (properties != null) {
                        entityManager = entityManagerFactory.createEntityManager(properties);
                    } else {
                        entityManager = entityManagerFactory.createEntityManager();
                    }
                    entityManagerTracker = new JtaEntityManagerRegistry.EntityManagerTracker(entityManager);
                } else {
                    entityManagerTracker.incCounter();
                }
View Full Code Here

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
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.