Ejemplo n.º 1
0
 /**
  * This method should be called only if it has been determined that field schema should be created
  * (or deleted). Create the {@link CustomField} for the metadata API to use during deploy
  *
  * @param cmd the class metadata for the entity
  * @param storeManager the store manager
  */
 public void createCustomFields(AbstractClassMetaData cmd, ForceStoreManager storeManager) {
   synchronized (cmd) {
     try {
       if (cmd.isEmbeddedOnly() || PersistenceUtils.isReadOnlySchema(cmd, false)) return;
       ForceManagedConnection mconn = storeManager.createConnection();
       try {
         ForceColumnMetaData cols = new ForceColumnMetaData(cmd, tableImpl, storeManager);
         cols.createFieldSchema(mconn.getNamespace());
         if (customObject == null) {
           createCustomObjectStub();
         }
         cols.addFieldsToObject(customObject);
       } catch (NucleusException ce) {
         throw ce;
       } catch (Exception e) {
         throw new NucleusException(e.getMessage(), e);
       } finally {
         mconn.close();
       }
     } catch (Exception e) {
       throw new NucleusUserException(
           "Exception during initialisation of metadata for " + cmd.getFullClassName(), e);
     }
   }
 }