コード例 #1
0
 /**
  * Initialize one persistence unit. Initialization is a two phase process. First the predeploy
  * process builds the metadata and creates any required transformers. Second the deploy process
  * creates a TopLink session based on that metadata.
  */
 protected void initPersistenceUnits(
     Archive archive, Map m, PersistenceInitializationActivator persistenceActivator) {
   Iterator<SEPersistenceUnitInfo> persistenceUnits =
       PersistenceUnitProcessor.getPersistenceUnits(archive, sessionClassLoader).iterator();
   while (persistenceUnits.hasNext()) {
     SEPersistenceUnitInfo persistenceUnitInfo = persistenceUnits.next();
     callPredeploy(persistenceUnitInfo, m, persistenceActivator);
   }
 }
コード例 #2
0
  /**
   * INTERNAL: Create a list of java.lang.Class that contains the classes of all the entities that
   * we will be deploying
   */
  protected Set loadEntityClasses(Collection entityNames, ClassLoader classLoader) {
    Set entityClasses = new HashSet();

    // Load the classes using the loader passed in
    AbstractSessionLog.getLog()
        .log(SessionLog.FINER, "cmp_loading_entities_using_loader", classLoader);
    for (Iterator iter = entityNames.iterator(); iter.hasNext(); ) {
      String entityClassName = (String) iter.next();
      try {
        entityClasses.add(classLoader.loadClass(entityClassName));
      } catch (ClassNotFoundException cnfEx) {
        throw ValidationException.entityClassNotFound(entityClassName, classLoader, cnfEx);
      }
    }
    return entityClasses;
  }