public void deleteFeeDetailByTenantIdx(CFSecurityAuthorization Authorization, long TenantId) {
   final String S_ProcName = "deleteFeeDetailByTenantIdx";
   if (!schema.isTransactionOpen()) {
     throw CFLib.getDefaultExceptionFactory()
         .newUsageException(getClass(), S_ProcName, "Transaction not open");
   }
   ResultSet resultSet = null;
   try {
     Connection cnx = schema.getCnx();
     String sql = "exec sp_delete_feedtl_by_tenantidx ?, ?, ?, ?, ?" + ", " + "?";
     if (stmtDeleteByTenantIdx == null) {
       stmtDeleteByTenantIdx = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     stmtDeleteByTenantIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtDeleteByTenantIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtDeleteByTenantIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtDeleteByTenantIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtDeleteByTenantIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtDeleteByTenantIdx.setLong(argIdx++, TenantId);
     Object stuff = null;
     boolean moreResults = stmtDeleteByTenantIdx.execute();
     while (stuff == null) {
       try {
         moreResults = stmtDeleteByTenantIdx.getMoreResults();
       } catch (SQLException e) {
         throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
       }
       if (moreResults) {
         try {
           stuff = stmtDeleteByTenantIdx.getResultSet();
         } catch (SQLException e) {
         }
       } else if (-1 == stmtDeleteByTenantIdx.getUpdateCount()) {
         break;
       }
     }
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
   }
 }
 public CFAccFeeDetailBuff lockBuff(
     CFSecurityAuthorization Authorization, CFAccFeeDetailPKey PKey) {
   final String S_ProcName = "lockBuff";
   if (!schema.isTransactionOpen()) {
     throw CFLib.getDefaultExceptionFactory()
         .newUsageException(getClass(), S_ProcName, "Transaction not open");
   }
   ResultSet resultSet = null;
   try {
     Connection cnx = schema.getCnx();
     long TenantId = PKey.getRequiredTenantId();
     long FeeDetailId = PKey.getRequiredFeeDetailId();
     String sql = "exec sp_lock_feedtl ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?";
     if (stmtLockBuffByPKey == null) {
       stmtLockBuffByPKey = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     stmtLockBuffByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtLockBuffByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtLockBuffByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtLockBuffByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtLockBuffByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtLockBuffByPKey.setLong(argIdx++, TenantId);
     stmtLockBuffByPKey.setLong(argIdx++, FeeDetailId);
     resultSet = stmtLockBuffByPKey.executeQuery();
     if (resultSet.next()) {
       CFAccFeeDetailBuff buff = unpackFeeDetailResultSetToBuff(resultSet);
       if (resultSet.next()) {
         resultSet.last();
         throw CFLib.getDefaultExceptionFactory()
             .newRuntimeException(
                 getClass(),
                 S_ProcName,
                 "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
       }
       return (buff);
     } else {
       return (null);
     }
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
   }
 }
 public CFAccFeeDetailBuff readBuffByIdIdx(
     CFSecurityAuthorization Authorization, long TenantId, long FeeDetailId) {
   final String S_ProcName = "readBuffByIdIdx";
   ResultSet resultSet = null;
   try {
     Connection cnx = schema.getCnx();
     String sql = "exec sp_read_feedtl_by_ididx ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?";
     if (stmtReadBuffByIdIdx == null) {
       stmtReadBuffByIdIdx = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     stmtReadBuffByIdIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByIdIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtReadBuffByIdIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtReadBuffByIdIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByIdIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtReadBuffByIdIdx.setLong(argIdx++, TenantId);
     stmtReadBuffByIdIdx.setLong(argIdx++, FeeDetailId);
     resultSet = stmtReadBuffByIdIdx.executeQuery();
     if (resultSet.next()) {
       CFAccFeeDetailBuff buff = unpackFeeDetailResultSetToBuff(resultSet);
       if (resultSet.next()) {
         resultSet.last();
         throw CFLib.getDefaultExceptionFactory()
             .newRuntimeException(
                 getClass(),
                 S_ProcName,
                 "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
       }
       return (buff);
     } else {
       return (null);
     }
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
   }
 }
 public CFAccFeeDetailBuff[] readBuffByFeeIdx(
     CFSecurityAuthorization Authorization, long TenantId, long FeeId) {
   final String S_ProcName = "readBuffByFeeIdx";
   ResultSet resultSet = null;
   try {
     Connection cnx = schema.getCnx();
     String sql = "exec sp_read_feedtl_by_feeidx ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?";
     if (stmtReadBuffByFeeIdx == null) {
       stmtReadBuffByFeeIdx = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     stmtReadBuffByFeeIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByFeeIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtReadBuffByFeeIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtReadBuffByFeeIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtReadBuffByFeeIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtReadBuffByFeeIdx.setLong(argIdx++, TenantId);
     stmtReadBuffByFeeIdx.setLong(argIdx++, FeeId);
     resultSet = stmtReadBuffByFeeIdx.executeQuery();
     List<CFAccFeeDetailBuff> buffList = new LinkedList<CFAccFeeDetailBuff>();
     while (resultSet.next()) {
       CFAccFeeDetailBuff buff = unpackFeeDetailResultSetToBuff(resultSet);
       buffList.add(buff);
     }
     int idx = 0;
     CFAccFeeDetailBuff[] retBuff = new CFAccFeeDetailBuff[buffList.size()];
     Iterator<CFAccFeeDetailBuff> iter = buffList.iterator();
     while (iter.hasNext()) {
       retBuff[idx++] = iter.next();
     }
     return (retBuff);
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
   }
 }
 public void deleteFeeDetailByIdIdx(
     CFSecurityAuthorization Authorization, long argTenantId, long argFeeDetailId) {
   final String S_ProcName = "deleteFeeDetailByIdIdx";
   ResultSet resultSet = null;
   try {
     Connection cnx = schema.getCnx();
     String sql =
         "begin call "
             + schema.getLowerDbSchemaName()
             + ".dl_feedtlbyididx( ?, ?, ?, ?, ?"
             + ", "
             + "?"
             + ", "
             + "?"
             + " ); end";
     if (stmtDeleteByIdIdx == null) {
       stmtDeleteByIdIdx = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     stmtDeleteByIdIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtDeleteByIdIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtDeleteByIdIdx.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtDeleteByIdIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtDeleteByIdIdx.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtDeleteByIdIdx.setLong(argIdx++, argTenantId);
     stmtDeleteByIdIdx.setLong(argIdx++, argFeeDetailId);
     int rowsUpdated = stmtDeleteByIdIdx.executeUpdate();
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
   }
 }
 public void deleteFeeDetailByIdIdx(
     CFSecurityAuthorization Authorization, long TenantId, long FeeDetailId) {
   final String S_ProcName = "deleteFeeDetailByIdIdx";
   try {
     Connection cnx = schema.getCnx();
     String sql = "exec sp_delete_feedtl ?, ?, ?, ?, ?" + ", " + "?" + ", " + "?";
     if (stmtDeleteByPKey == null) {
       stmtDeleteByPKey = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     stmtDeleteByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtDeleteByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtDeleteByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtDeleteByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtDeleteByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtDeleteByPKey.setLong(argIdx++, TenantId);
     stmtDeleteByPKey.setLong(argIdx++, FeeDetailId);
     Object stuff = null;
     boolean moreResults = stmtDeleteByPKey.execute();
     while (stuff == null) {
       try {
         moreResults = stmtDeleteByPKey.getMoreResults();
       } catch (SQLException e) {
         throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
       }
       if (moreResults) {
         try {
           stuff = stmtDeleteByPKey.getResultSet();
         } catch (SQLException e) {
         }
       } else if (-1 == stmtDeleteByPKey.getUpdateCount()) {
         break;
       }
     }
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   }
 }
 public void createFeeDetail(CFSecurityAuthorization Authorization, CFAccFeeDetailBuff Buff) {
   final String S_ProcName = "createFeeDetail";
   if (!schema.isTransactionOpen()) {
     throw CFLib.getDefaultExceptionFactory()
         .newUsageException(getClass(), S_ProcName, "Transaction not open");
   }
   ResultSet resultSet = null;
   try {
     long TenantId = Buff.getRequiredTenantId();
     long FeeId = Buff.getRequiredFeeId();
     String Description = Buff.getRequiredDescription();
     BigDecimal AmountCharged = Buff.getRequiredAmountCharged();
     Connection cnx = schema.getCnx();
     String sql =
         "exec sp_create_feedtl ?, ?, ?, ?, ?, ?"
             + ", "
             + "?"
             + ", "
             + "?"
             + ", "
             + "?"
             + ", "
             + "?";
     if (stmtCreateByPKey == null) {
       stmtCreateByPKey = cnx.prepareStatement(sql);
     }
     int argIdx = 1;
     stmtCreateByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtCreateByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecUserId().toString());
     stmtCreateByPKey.setString(
         argIdx++, (Authorization == null) ? "" : Authorization.getSecSessionId().toString());
     stmtCreateByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecClusterId());
     stmtCreateByPKey.setLong(
         argIdx++, (Authorization == null) ? 0 : Authorization.getSecTenantId());
     stmtCreateByPKey.setString(argIdx++, "FEDT");
     stmtCreateByPKey.setLong(argIdx++, TenantId);
     stmtCreateByPKey.setLong(argIdx++, FeeId);
     stmtCreateByPKey.setString(argIdx++, Description);
     stmtCreateByPKey.setBigDecimal(argIdx++, AmountCharged);
     resultSet = stmtCreateByPKey.executeQuery();
     if (resultSet.next()) {
       CFAccFeeDetailBuff createdBuff = unpackFeeDetailResultSetToBuff(resultSet);
       if (resultSet.next()) {
         resultSet.last();
         throw CFLib.getDefaultExceptionFactory()
             .newRuntimeException(
                 getClass(),
                 S_ProcName,
                 "Did not expect multi-record response, " + resultSet.getRow() + " rows selected");
       }
       Buff.setRequiredTenantId(createdBuff.getRequiredTenantId());
       Buff.setRequiredFeeId(createdBuff.getRequiredFeeId());
       Buff.setRequiredFeeDetailId(createdBuff.getRequiredFeeDetailId());
       Buff.setRequiredDescription(createdBuff.getRequiredDescription());
       Buff.setRequiredAmountCharged(createdBuff.getRequiredAmountCharged());
       Buff.setRequiredRevision(createdBuff.getRequiredRevision());
       Buff.setCreatedByUserId(createdBuff.getCreatedByUserId());
       Buff.setCreatedAt(createdBuff.getCreatedAt());
       Buff.setUpdatedByUserId(createdBuff.getUpdatedByUserId());
       Buff.setUpdatedAt(createdBuff.getUpdatedAt());
     } else {
       throw CFLib.getDefaultExceptionFactory()
           .newRuntimeException(
               getClass(),
               S_ProcName,
               "Expected a single-record response, " + resultSet.getRow() + " rows selected");
     }
   } catch (SQLException e) {
     throw CFLib.getDefaultExceptionFactory().newDbException(getClass(), S_ProcName, e);
   } finally {
     if (resultSet != null) {
       try {
         resultSet.close();
       } catch (SQLException e) {
       }
       resultSet = null;
     }
   }
 }
  /**
   * Release the prepared statements.
   *
   * <p>When the schema changes connections, the prepared statements have to be released because
   * they contain connection-specific information for most databases.
   */
  public void releasePreparedStatements() {
    final String S_ProcName = "releasePreparedStatements";
    S_sqlSelectFeeDetailDistinctClassCode = null;
    S_sqlSelectFeeDetailBuff = null;

    if (stmtReadBuffByPKey != null) {
      try {
        stmtReadBuffByPKey.close();
      } catch (SQLException e) {
        //				throw CFLib.getDefaultExceptionFactory().newDbException( getClass(),
        //					S_ProcName,
        //					e );
      }
      stmtReadBuffByPKey = null;
    }
    if (stmtLockBuffByPKey != null) {
      try {
        stmtLockBuffByPKey.close();
      } catch (SQLException e) {
        //				throw CFLib.getDefaultExceptionFactory().newDbException( getClass(),
        //					S_ProcName,
        //					e );
      }
      stmtLockBuffByPKey = null;
    }
    if (stmtCreateByPKey != null) {
      try {
        stmtCreateByPKey.close();
      } catch (SQLException e) {
        //				throw CFLib.getDefaultExceptionFactory().newDbException( getClass(),
        //					S_ProcName,
        //					e );
      }
      stmtCreateByPKey = null;
    }
    if (stmtUpdateByPKey != null) {
      try {
        stmtUpdateByPKey.close();
      } catch (SQLException e) {
        //				throw CFLib.getDefaultExceptionFactory().newDbException( getClass(),
        //					S_ProcName,
        //					e );
      }
      stmtUpdateByPKey = null;
    }
    if (stmtDeleteByPKey != null) {
      try {
        stmtDeleteByPKey.close();
      } catch (SQLException e) {
        //				throw CFLib.getDefaultExceptionFactory().newDbException( getClass(),
        //					S_ProcName,
        //					e );
      }
      stmtDeleteByPKey = null;
    }
    if (stmtReadAllBuff != null) {
      try {
        stmtReadAllBuff.close();
      } catch (SQLException e) {
        //				throw CFLib.getDefaultExceptionFactory().newDbException( getClass(),
        //					S_ProcName,
        //					e );
      } finally {
        stmtReadAllBuff = null;
      }
    }
    if (stmtReadBuffByTenantIdx != null) {
      try {
        stmtReadBuffByTenantIdx.close();
      } catch (SQLException e) {
        //				throw CFLib.getDefaultExceptionFactory().newDbException( getClass(),
        //					S_ProcName,
        //					e );
      } finally {
        stmtReadBuffByTenantIdx = null;
      }
    }
    if (stmtReadBuffByFeeIdx != null) {
      try {
        stmtReadBuffByFeeIdx.close();
      } catch (SQLException e) {
        //				throw CFLib.getDefaultExceptionFactory().newDbException( getClass(),
        //					S_ProcName,
        //					e );
      } finally {
        stmtReadBuffByFeeIdx = null;
      }
    }
    if (stmtDeleteByTenantIdx != null) {
      try {
        stmtDeleteByTenantIdx.close();
      } catch (SQLException e) {
        //				throw CFLib.getDefaultExceptionFactory().newDbException( getClass(),
        //					S_ProcName,
        //					e );
      } finally {
        stmtDeleteByTenantIdx = null;
      }
    }
    if (stmtDeleteByFeeIdx != null) {
      try {
        stmtDeleteByFeeIdx.close();
      } catch (SQLException e) {
        //				throw CFLib.getDefaultExceptionFactory().newDbException( getClass(),
        //					S_ProcName,
        //					e );
      } finally {
        stmtDeleteByFeeIdx = null;
      }
    }
    if (stmtReadBuffByTenantIdx != null) {
      try {
        stmtReadBuffByTenantIdx.close();
      } catch (SQLException e) {
        //				throw CFLib.getDefaultExceptionFactory().newDbException( getClass(),
        //					S_ProcName,
        //					e );
      } finally {
        stmtReadBuffByTenantIdx = null;
      }
    }
    if (stmtReadBuffByFeeIdx != null) {
      try {
        stmtReadBuffByFeeIdx.close();
      } catch (SQLException e) {
        //				throw CFLib.getDefaultExceptionFactory().newDbException( getClass(),
        //					S_ProcName,
        //					e );
      } finally {
        stmtReadBuffByFeeIdx = null;
      }
    }
  }