Examples of EntityManagerFactoryImpl


Examples of org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl

    protected Set<WeakReference<EntityManagerFactoryImpl>> factories = new HashSet<WeakReference<EntityManagerFactoryImpl>>();
   
    public synchronized Attribute<X, T> getAttribute(){
        if (attribute == null){
            for (WeakReference<EntityManagerFactoryImpl> factoryRef: factories){
                EntityManagerFactoryImpl factory = factoryRef.get();
                if (factory != null){
                    factory.getDatabaseSession();
                } else {
                    factories.remove(factoryRef);
                }
            }
        }
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl

                // it has been undeployed by factory.close() in another thread - start all over again.
                return createEntityManagerFactory(emName, properties, classLoader);
            }
        }
           
        EntityManagerFactoryImpl factory = null;
        try {
            factory = new EntityManagerFactoryImpl(emSetupImpl, nonNullProperties);
       
            // This code has been added to allow validation to occur without actually calling createEntityManager
            if (emSetupImpl.shouldGetSessionOnCreateFactory(nonNullProperties)) {
                factory.getServerSession();
            }
            return factory;
        } catch (RuntimeException ex) {
            if(factory != null) {
                factory.close();
            } else {
                emSetupImpl.undeploy();
            }
            throw ex;
        }
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl

        if (transformer != null){
            info.addTransformer(transformer);
        }
        // When EntityManagerFactory is created, the session is only partially created
        // When the factory is actually accessed, the emSetupImpl will be used to complete the session construction
        EntityManagerFactoryImpl factory = new EntityManagerFactoryImpl(emSetupImpl, nonNullProperties);

        // This code has been added to allow validation to occur without actually calling createEntityManager
        if (emSetupImpl.shouldGetSessionOnCreateFactory(nonNullProperties)) {
            factory.getServerSession();
        }
        return factory;
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl

            // call predeploy
            // this will just increment the factory count since we should already be deployed
            emSetupImpl.predeploy(emSetupImpl.getPersistenceUnitInfo(), nonNullProperties);
        }
           
        EntityManagerFactoryImpl factory = null;
        try {
            factory = new EntityManagerFactoryImpl(emSetupImpl, nonNullProperties);
       
            // This code has been added to allow validation to occur without actually calling createEntityManager
            if (emSetupImpl.shouldGetSessionOnCreateFactory(nonNullProperties)) {
                factory.getServerSession();
            }
            return factory;
        } catch (RuntimeException ex) {
            if(factory != null) {
                factory.close();
            } else {
                emSetupImpl.undeploy();
            }
            throw ex;
        }
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl

        if (transformer != null){
            info.addTransformer(transformer);
        }
        // When EntityManagerFactory is created, the session is only partially created
        // When the factory is actually accessed, the emSetupImpl will be used to complete the session construction
        EntityManagerFactoryImpl factory = new EntityManagerFactoryImpl(emSetupImpl, nonNullProperties);

        // This code has been added to allow validation to occur without actually calling createEntityManager
        if (emSetupImpl.shouldGetSessionOnCreateFactory(nonNullProperties)) {
            factory.getServerSession();
        }
        return factory;
    }
View Full Code Here

Examples of org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl

                properties.put(PersistenceUnitProperties.CLASSLOADER, dcl);
                if (initializationProperties != null) {
                    properties.putAll(initializationProperties);
                }

                EntityManagerFactoryImpl factory = (EntityManagerFactoryImpl) Persistence.createEntityManagerFactory(persistenceUnitName, properties);
                ClassLoader sessionLoader = factory.getServerSession().getLoader();
                if (!DynamicClassLoader.class.isAssignableFrom(sessionLoader.getClass())) {
                    properties = new HashMap<String, Object>();
                    dcl = new DynamicClassLoader(sessionLoader);
                    properties.put(PersistenceUnitProperties.CLASSLOADER, dcl);
                    if (initializationProperties != null) {
                        properties.putAll(initializationProperties);
                    }
                    factory.refreshMetadata(properties);
                }

                if (factory != null) {
                    persistenceContext = bootstrapPersistenceContext(persistenceUnitName, factory, defaultURI, version, true);
                    Set<PersistenceContext> persistenceContextSet = getDynamicPersistenceContextSet(persistenceUnitName);
View Full Code Here

Examples of org.hibernate.ejb.EntityManagerFactoryImpl

    private static ApplicationContext ctx = null;

    public static Statistics getStatistics() {
        EntityManagerFactoryInfo entityManagerFactoryInfo = (EntityManagerFactoryInfo) ctx.getBean("entityManagerFactory");
        EntityManagerFactory emf = entityManagerFactoryInfo.getNativeEntityManagerFactory();
        EntityManagerFactoryImpl emfImp = (EntityManagerFactoryImpl) emf;
        return emfImp.getSessionFactory().getStatistics();
    }
View Full Code Here

Examples of org.hibernate.ejb.EntityManagerFactoryImpl

                path = path.get(piece);
            } catch (IllegalArgumentException e) {
                // We weren't able to resolve the requested piece, likely because it's in a polymoprhic version
                // of the path we're currently on. Let's see if there's any polymoprhic version of our class to
                // use instead.
              EntityManagerFactoryImpl em = ((CriteriaBuilderImpl) builder).getEntityManagerFactory();
              Metamodel mm = em.getMetamodel();
              boolean found = false;
             
              Class<?>[] polyClasses = dynamicDaoHelper.getAllPolymorphicEntitiesFromCeiling(
                      path.getJavaType(), em.getSessionFactory(), true, true);
             
              for (Class<?> clazz : polyClasses) {
                ManagedType mt = mm.managedType(clazz);
                try {
                    Attribute attr = mt.getAttribute(piece);
View Full Code Here

Examples of org.hibernate.jpa.internal.EntityManagerFactoryImpl

              sessionFactory.addObserver( suppliedSessionFactoryObserver );
            }
            sessionFactory.addObserver( new ServiceRegistryCloser() );

            // NOTE : passing cfg is temporary until
            return new EntityManagerFactoryImpl(
                persistenceUnit.getName(),
                sessionFactory,
                settings,
                configurationValues,
                hibernateConfiguration
View Full Code Here

Examples of org.hibernate.jpa.internal.EntityManagerFactoryImpl

              sessionFactory.addObserver( suppliedSessionFactoryObserver );
            }
            sessionFactory.addObserver( new ServiceRegistryCloser() );

            // NOTE : passing cfg is temporary until
            return new EntityManagerFactoryImpl(
                persistenceUnit.getName(),
                sessionFactory,
                settings,
                configurationValues,
                hibernateConfiguration
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.