Package javax.persistence.spi

Examples of javax.persistence.spi.PersistenceProvider.createContainerEntityManagerFactory()


          for(Entry<String, ? extends ManagedPersistenceUnitInfo> entry :
               persistenceUnits.entrySet()){
            ManagedPersistenceUnitInfo mpui = entry.getValue();
            emfs.put(entry.getKey(), new CountingEntityManagerFactory(
                providerService.createContainerEntityManagerFactory(
                    mpui.getPersistenceUnitInfo(), mpui.getContainerProperties()), entry.getKey()));
          }
        } finally {
          //Remember to unget the provider
          containerContext.ungetService(provider);
View Full Code Here


                String providerClassName = info.getPersistenceProviderClassName();

                final PersistenceProvider persistenceProvider = getPersistenceProvider(persistenceUnitName, providerClassName);

                return persistenceProvider.createContainerEntityManagerFactory(info, properties);
            }
        }

        throw new IllegalStateException(String.format(
                "Failed to create EntityManagerFactory for persistence unit '%s'",
View Full Code Here

    try {
      PersistenceProvider provider = (PersistenceProvider) cl.newInstance();

      HashMap<String,Object> map = null;
     
      _emfDelegate = provider.createContainerEntityManagerFactory(this, map);
     
      if (_emfDelegate == null)
        throw new IllegalStateException(L.l("{0} did not return an EntityManagerFactory",
                                            provider));
    } catch (Exception e) {
View Full Code Here

    if (logger.isInfoEnabled()) {
      logger.info("Building JPA container EntityManagerFactory for persistence unit '" +
          this.persistenceUnitInfo.getPersistenceUnitName() + "'");
    }
    this.nativeEntityManagerFactory =
        provider.createContainerEntityManagerFactory(this.persistenceUnitInfo, getJpaPropertyMap());
    postProcessEntityManagerFactory(this.nativeEntityManagerFactory, this.persistenceUnitInfo);

    return this.nativeEntityManagerFactory;
  }
View Full Code Here

            // Create entity manager factories with the validator factory
            final Map<String, Object> properties = new HashMap<String, Object>();
            if (!ValidationMode.NONE.equals(unitInfo.getValidationMode())) {
                properties.put("javax.persistence.validator.ValidatorFactory", new ValidatorFactoryWrapper());
            }
            EntityManagerFactory emf = persistenceProvider.createContainerEntityManagerFactory(unitInfo, properties);

            if ((unitInfo.getProperties() != null
                    && "true".equalsIgnoreCase(unitInfo.getProperties().getProperty(OPENEJB_JPA_INIT_ENTITYMANAGER)))
                    || SystemInstance.get().getOptions().get(OPENEJB_JPA_INIT_ENTITYMANAGER, false)) {
                emf.createEntityManager().close();
View Full Code Here

        unitInfo.setTransactionType(transactionType);

        unitInfo.getManagedClassNames().add("org.apache.openejb.core.cmp.jpa.Employee");

        PersistenceProvider persistenceProvider = (PersistenceProvider) getClass().getClassLoader().loadClass(PERSISTENCE_PROVIDER).newInstance();
        EntityManagerFactory emf = persistenceProvider.createContainerEntityManagerFactory(unitInfo, new HashMap());

        return emf;
    }

    private static void set(Object instance, String parameterName, Class type, Object value) throws Exception {
View Full Code Here

                    }
                    Class clazz = classLoader.loadClass(unit.provider);
                    PersistenceProvider persistenceProvider = (PersistenceProvider) clazz.newInstance();

                    // Create entity manager factory
                    EntityManagerFactory emf = persistenceProvider.createContainerEntityManagerFactory(info, new HashMap());
                    debug("success: " + provider);
                } catch (Throwable e) {
                    debug("failed: " + provider, e);
                }
            }
View Full Code Here

    if (logger.isInfoEnabled()) {
      logger.info("Building JPA container EntityManagerFactory for persistence unit '" +
          this.persistenceUnitInfo.getPersistenceUnitName() + "'");
    }
    this.nativeEntityManagerFactory =
        provider.createContainerEntityManagerFactory(this.persistenceUnitInfo, getJpaPropertyMap());
    postProcessEntityManagerFactory(this.nativeEntityManagerFactory, this.persistenceUnitInfo);

    return this.nativeEntityManagerFactory;
  }
View Full Code Here

        props.put(PersistenceUnitProperties.WEAVING, "FALSE");

        provider = new org.eclipse.persistence.jpa.PersistenceProvider();
        EntityManagerFactory emf = null;
        try {
            emf = provider.createContainerEntityManagerFactory(pi, props);
            logger.logp(Level.FINE, "DefaultProviderVerification", "check",
                    "emf = {0}", emf);
        } catch(IntegrityException ie){
            result.setStatus(Result.FAILED);
            addErrorDetails(result, getVerifierContext().getComponentNameConstructor());
View Full Code Here

    }

    @Override
    public EntityManagerFactory createContainerEntityManagerFactory(final PersistenceUnitInfo info, final Map map) {
        final PersistenceProvider persistenceProvider = findDelegate(map);
        final EntityManagerFactory containerEntityManagerFactory = persistenceProvider.createContainerEntityManagerFactory(
            PersistenceUnitInfo.class.cast(Proxy.newProxyInstance(tccl(), new Class<?>[]{PersistenceUnitInfo.class}, new ProviderAwareHandler(persistenceProvider.getClass().getName(), info))),
            map);
        if (containerEntityManagerFactory == null) {
            return null;
        }
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.