/**
   * Returns the SQL fragment string needed by insert or update statements within insert or update
   * method of sub-classes. This is done to avoid code duplication.
   */
  protected String getSQLStatementFragment(Object object) throws RegistryException {
    // object must be an ObjectRef for an objects affected by parent event
    ObjectRefType affectedObject = (ObjectRefType) object;

    String stmtFragment = null;

    String id = affectedObject.getId();
    String home = affectedObject.getHome();

    if (home != null) {
      home = "'" + home + "'";
    }

    String eventId = ((AuditableEventType) parent).getId();

    if (action == DAO_ACTION_INSERT) {
      stmtFragment =
          "INSERT INTO AffectedObject VALUES("
              + " '"
              + id
              + "', "
              + home
              + ", '"
              + eventId
              + "' ) ";
    } else if (action == DAO_ACTION_UPDATE) {
      throw new RegistryException(
          ServerResourceBundle.getInstance().getString("message.cannotUpdateComposedObject"));
    } else if (action == DAO_ACTION_DELETE) {
      stmtFragment = super.getSQLStatementFragment(object);
    }

    return stmtFragment;
  }
  protected void loadObject(Object obj, ResultSet rs) throws RegistryException {
    try {
      if (!(obj instanceof org.oasis.ebxml.registry.bindings.rim.ObjectRefType)) {
        throw new RegistryException(
            ServerResourceBundle.getInstance()
                .getString("message.ObjectRefTypeExpected", new Object[] {obj}));
      }

      ObjectRefType ro = (ObjectRefType) obj;
      ro.setId(rs.getString("id"));

      String home = rs.getString("home");
      if (home != null) {
        ro.setHome(home);
      }

    } catch (SQLException e) {
      log.error(ServerResourceBundle.getInstance().getString("message.CaughtException1"), e);
      throw new RegistryException(e);
    }
  }