@Override
 public void remove(Connection connection, WAPrimaryKey pk) throws PersistenceException {
   Connection con;
   if (connection == null) {
     con = getConnection();
   } else {
     con = connection;
   }
   PreparedStatement prepStmt = null;
   try {
     String updateStatement = "delete from " + getTableName(pk) + " where id = ?";
     prepStmt = con.prepareStatement(updateStatement);
     SilverTrace.info(
         "persistence",
         "SilverpeasBeanDAOImpl.remove(WAPrimaryKey pk)",
         "root.MSG_GEN_PARAM_VALUE",
         "queryStr = " + updateStatement + ", id= " + pk.getId());
     prepStmt.setInt(1, Integer.parseInt(pk.getId()));
     prepStmt.executeUpdate();
   } catch (SQLException e) {
     throw new PersistenceException(
         "SilverpeasBeanDAOImpl.remove(WAPrimaryKey pk)",
         SilverpeasException.ERROR,
         "persistence.EX_CANT_REMOVE_OBJECT",
         "",
         e);
   } finally {
     DBUtil.close(prepStmt);
     if (connection == null) {
       DBUtil.close(con);
     }
   }
 }
  @Override
  public T findByPrimaryKey(Connection connection, WAPrimaryKey pk) throws PersistenceException {
    PreparedStatement prepStmt = null;
    Connection con;
    if (connection == null) {
      con = getConnection();
    } else {
      con = connection;
    }
    ResultSet rs = null;
    try {
      String selectStatement =
          "select  " + getColumnNames() + " from " + getTableName(pk) + " where id = ?";

      SilverTrace.info(
          "persistence",
          "SilverpeasBeanDAOImpl.findByPrimaryKey(WAPrimaryKey pk)",
          "root.MSG_GEN_PARAM_VALUE",
          "queryStr = " + selectStatement + ", id= " + pk.getId());
      prepStmt = con.prepareStatement(selectStatement);
      prepStmt.setInt(1, Integer.parseInt(pk.getId()));
      rs = prepStmt.executeQuery();
      if (rs.next()) {
        return getSilverpeasBeanFromResultSet(pk, rs);
      }
      return null;
    } catch (Exception e) {
      throw new PersistenceException(
          "SilverpeasBeanDAOImpl.findByPrimaryKey(WAPrimaryKey pk)",
          SilverpeasException.ERROR,
          "persistence.EX_CANT_FIND_OBJECT",
          "",
          e);
    } finally {
      DBUtil.close(rs, prepStmt);
      if (connection == null) {
        DBUtil.close(con);
      }
    }
  }
  @Override
  public Collection<T> findByWhereClause(Connection connection, WAPrimaryKey pk, String whereClause)
      throws PersistenceException {
    PreparedStatement prepStmt = null;
    Connection con;
    if (connection == null) {
      con = getConnection();
    } else {
      con = connection;
    }
    ResultSet rs = null;
    try {
      String selectStatement = "select distinct " + getColumnNames() + " from " + getTableName(pk);
      if (whereClause != null) {
        selectStatement += " where " + whereClause;
      }

      SilverTrace.info(
          "persistence",
          "SilverpeasBeanDAOImpl.findByWhereClause(WAPrimaryKey pk, String whereClause)",
          "root.MSG_GEN_PARAM_VALUE",
          "queryStr = "
              + selectStatement
              + ", id= "
              + pk.getId()
              + ", whereClause= "
              + whereClause);
      prepStmt = con.prepareStatement(selectStatement);

      rs = prepStmt.executeQuery();
      List<T> list = new ArrayList<T>();
      while (rs.next()) {
        T bean = getSilverpeasBeanFromResultSet(pk, rs);
        list.add(bean);
      }
      return list;
    } catch (Exception e) {
      throw new PersistenceException(
          "SilverpeasBeanDAOImpl.findByWhereClause(WAPrimaryKey pk, String whereClause)",
          SilverpeasException.ERROR,
          "persistence.EX_CANT_FIND_OBJECT",
          "",
          e);
    } finally {
      DBUtil.close(rs, prepStmt);
      if (connection == null) {
        DBUtil.close(con);
      }
    }
  }
 protected Collection<Alias> getPublicationAliases(WAPrimaryKey pk)
     throws CreateException, RemoteException {
   return findPublicationBm().getAlias(new PublicationPK(pk.getId(), pk.getInstanceId()));
 }
 protected Collection<NodePK> getPublicationFathers(WAPrimaryKey pk)
     throws CreateException, RemoteException {
   return findPublicationBm().getAllFatherPK(new PublicationPK(pk.getId(), pk.getInstanceId()));
 }