コード例 #1
0
 public static PersistenceUnitMetadata resolvePersistenceUnitSupplier(
     DeploymentUnit deploymentUnit, String persistenceUnitName) {
   if (traceEnabled) {
     ROOT_LOGGER.tracef(
         "pu search for name '%s' inside of %s", persistenceUnitName, deploymentUnit.getName());
   }
   int scopeSeparatorCharacter =
       (persistenceUnitName == null ? -1 : persistenceUnitName.indexOf('#'));
   if (scopeSeparatorCharacter != -1) {
     final String path = persistenceUnitName.substring(0, scopeSeparatorCharacter);
     final String name = persistenceUnitName.substring(scopeSeparatorCharacter + 1);
     PersistenceUnitMetadata pu = getPersistenceUnit(deploymentUnit, path, name);
     if (traceEnabled) {
       ROOT_LOGGER.tracef("pu search found %s", pu.getScopedPersistenceUnitName());
     }
     return pu;
   } else {
     PersistenceUnitMetadata name =
         findPersistenceUnitSupplier(deploymentUnit, persistenceUnitName);
     if (traceEnabled) {
       if (name != null) {
         ROOT_LOGGER.tracef("pu search found %s", name.getScopedPersistenceUnitName());
       }
     }
     return name;
   }
 }
コード例 #2
0
 /**
  * Create EE container entity manager factory
  *
  * @return EntityManagerFactory
  */
 private EntityManagerFactory createContainerEntityManagerFactory() {
   persistenceProviderAdaptor.beforeCreateContainerEntityManagerFactory(pu);
   try {
     JPA_LOGGER.tracef(
         "calling createContainerEntityManagerFactory for pu=%s with integration properties=%s, application properties=%s",
         pu.getScopedPersistenceUnitName(), properties.getValue(), pu.getProperties());
     return persistenceProvider.createContainerEntityManagerFactory(pu, properties.getValue());
   } finally {
     try {
       persistenceProviderAdaptor.afterCreateContainerEntityManagerFactory(pu);
     } finally {
       pu.setAnnotationIndex(
           null); // close reference to Annotation Index (only needed during call to
                  // createContainerEntityManagerFactory)
       // This is needed if the datasource is restarted
       // pu.setTempClassLoaderFactory(null);    // close reference to temp classloader factory
       // (only needed during call to createEntityManagerFactory)
     }
   }
 }
コード例 #3
0
 /**
  * Returns the Persistence Unit service name used for creation or lookup. The service name
  * contains the unique fully scoped persistence unit name
  *
  * @param pu persistence unit definition
  * @return
  */
 public static ServiceName getPUServiceName(PersistenceUnitMetadata pu) {
   return JPAServiceNames.getPUServiceName(pu.getScopedPersistenceUnitName());
 }
コード例 #4
0
 @Override
 public String getScopedPersistenceUnitName() {
   return pu.getScopedPersistenceUnitName();
 }