Examples of PersistenceUnitManager


Examples of org.ow2.easybeans.persistence.PersistenceUnitManager

        // Child of the EAR classloader with RARs
        ClassLoader ejbClassLoader = new EasyBeansClassLoader(arrayURLs, earClassLoader);

        // Get Persistence unit manager
        PersistenceUnitManager persistenceUnitManager = getPersistenceUnitManager(earDeployable, ejbClassLoader);

        // Get Extra libraries
        List<IArchive> libArchives = getLibArchives(earDeployable);

View Full Code Here

Examples of org.ow2.easybeans.persistence.PersistenceUnitManager

            if (logger.isDebugEnabled()) {
                logger.debug("Enhancement elapsed during : " + (System.currentTimeMillis() - tStartEnhancing) + " ms");
            }

            // Check if there is META-INF/persistence.xml file
            PersistenceUnitManager analyzedPersistenceUnitManager = null;
            try {
                JPersistenceUnitInfo[] persistenceUnitInfos =
                        PersistenceXmlFileAnalyzer.analyzePersistenceXmlFile(getArchive());

                // Dispatch life cycle event.
                this.dispatcher.dispatch(new EventContainerStarting(this.j2eeManagedObjectId, getArchive(),
                                                                    persistenceUnitInfos, this.configuration));

                if (persistenceUnitInfos != null) {
                    analyzedPersistenceUnitManager =
                            PersistenceXmlFileAnalyzer.loadPersistenceProvider(persistenceUnitInfos, getClassLoader());
                }
            } catch (PersistenceXmlFileAnalyzerException e) {
                throw new EZBContainerException("Cannot analyze the persistence.xml file in the archive", e);
            }

            // No previous manager
            if (this.persistenceUnitManager == null) {
                this.persistenceUnitManager = analyzedPersistenceUnitManager;
            } else {
                // merge old and new.
                if (analyzedPersistenceUnitManager != null) {
                    analyzedPersistenceUnitManager.merge(this.persistenceUnitManager);
                    // update persistence manager with the merged one.
                    this.persistenceUnitManager = analyzedPersistenceUnitManager;
                }
            }
View Full Code Here

Examples of org.ow2.easybeans.persistence.PersistenceUnitManager

        // Create classloader with these URLs
        URL[] arrayURLs = urls.toArray(new URL[urls.size()]);
        ClassLoader ejbClassLoader = new EasyBeansClassLoader(arrayURLs, Thread.currentThread().getContextClassLoader());

        // Get Persistence unit manager
        PersistenceUnitManager persistenceUnitManager = getPersistenceUnitManager(earDeployable, ejbClassLoader);

        // Get Extra libraries
        List<IArchive> libArchives = getLibArchives(earDeployable);

View Full Code Here

Examples of org.ow2.easybeans.persistence.PersistenceUnitManager

        // Build classloader
        ClassLoader appClassLoader = getClassLoaderForEAR(earDeployable);

        // Get Persistence unit manager
        PersistenceUnitManager persistenceUnitManager = getPersistenceUnitManager(earDeployable, appClassLoader);

        // Get Extra libraries
        List<IArchive> libArchives = getLibArchives(earDeployable);

        // Create containers for each EJB deployable
View Full Code Here

Examples of org.ow2.easybeans.persistence.PersistenceUnitManager

            final ClassLoader appClassLoader) {
        // Analyze libraries to detect persistence archive (only once for now
        // and for all libraries)
        // Get libraries of this EAR
        List<LibDeployable> libs = earDeployable.getLibDeployables();
        PersistenceUnitManager persistenceUnitManager = null;
        for (LibDeployable lib : libs) {
            PersistenceUnitManager builtPersistenceUnitManager = null;
            try {
                JPersistenceUnitInfo[] persistenceUnitInfos =
                        PersistenceXmlFileAnalyzer.analyzePersistenceXmlFile(lib.getArchive());
                if (persistenceUnitInfos != null) {
                    builtPersistenceUnitManager =
                            PersistenceXmlFileAnalyzer.loadPersistenceProvider(persistenceUnitInfos, appClassLoader);
                }
            } catch (PersistenceXmlFileAnalyzerException e) {
                throw new IllegalStateException("Failure when analyzing the persistence.xml file", e);
            }

            // Existing manager and new manager found
            if (persistenceUnitManager != null) {
                if (builtPersistenceUnitManager != null) {
                    // Add the persistence unit infos to the existing
                    // persistence unit manager
                    persistenceUnitManager.addExtraPersistenceUnitInfos(builtPersistenceUnitManager.getPersistenceUnitInfos());
                }
            } else {
                // New persistence manager use the built manager
                persistenceUnitManager = builtPersistenceUnitManager;
            }
View Full Code Here

Examples of org.ow2.easybeans.persistence.PersistenceUnitManager

                // Set persistence provider
                persistenceUnitInfo.setPersistenceProvider(persistenceProvider);
            }
        }
        // create persistence unit manager
        return new PersistenceUnitManager(persistenceUnitInfos);
    }
View Full Code Here

Examples of org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager

  }


  @Override
  protected EntityManagerFactory createNativeEntityManagerFactory() throws PersistenceException {
    PersistenceUnitManager managerToUse = this.persistenceUnitManager;
    if (this.persistenceUnitManager == null) {
      this.internalPersistenceUnitManager.afterPropertiesSet();
      managerToUse = this.internalPersistenceUnitManager;
    }
View Full Code Here

Examples of org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager

  }


  @Override
  protected EntityManagerFactory createNativeEntityManagerFactory() throws PersistenceException {
    PersistenceUnitManager managerToUse = this.persistenceUnitManager;
    if (this.persistenceUnitManager == null) {
      this.internalPersistenceUnitManager.afterPropertiesSet();
      managerToUse = this.internalPersistenceUnitManager;
    }
View Full Code Here

Examples of org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager

  }


  @Override
  protected EntityManagerFactory createNativeEntityManagerFactory() throws PersistenceException {
    PersistenceUnitManager managerToUse = this.persistenceUnitManager;
    if (this.persistenceUnitManager == null) {
      this.internalPersistenceUnitManager.afterPropertiesSet();
      managerToUse = this.internalPersistenceUnitManager;
    }
View Full Code Here

Examples of org.springframework.orm.jpa.persistenceunit.PersistenceUnitManager

  }


  @Override
  protected EntityManagerFactory createNativeEntityManagerFactory() throws PersistenceException {
    PersistenceUnitManager managerToUse = this.persistenceUnitManager;
    if (this.persistenceUnitManager == null) {
      this.internalPersistenceUnitManager.afterPropertiesSet();
      managerToUse = this.internalPersistenceUnitManager;
    }
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.