public Collection ejbFindEx(String NOM_TPL_CON, String DES_TPL_CON, int iOrderBy) {
    String strSql = "SELECT cod_TPL_CON, nom_TPL_CON, des_TPL_CON FROM TPL_CON_tab ";
    if (NOM_TPL_CON != null) {
      strSql += " WHERE UPPER(NOM_TPL_CON) LIKE ?";
    }
    if (DES_TPL_CON != null) {
      if (NOM_TPL_CON != null) {
        strSql += " AND ";
      } else {
        strSql += " WHERE ";
      }
      strSql += " UPPER(DES_TPL_CON) LIKE ?";
    }

    strSql += " ORDER BY " + Math.abs(iOrderBy) + (iOrderBy > 0 ? " ASC" : "DESC");
    int i = 1;
    BMPConnection bmp = getConnection();
    try {
      PreparedStatement ps = bmp.prepareStatement(strSql);

      if (NOM_TPL_CON != null) {
        ps.setString(i++, NOM_TPL_CON.toUpperCase());
      }
      if (DES_TPL_CON != null) {
        ps.setString(i++, DES_TPL_CON.toUpperCase());
      }

      ResultSet rs = ps.executeQuery();
      java.util.ArrayList ar = new java.util.ArrayList();
      while (rs.next()) {
        TipologiaContratti_View w = new TipologiaContratti_View();
        w.lCOD_TPL_CON = rs.getLong("COD_TPL_CON");
        w.strNOM_TPL_CON = rs.getString("NOM_TPL_CON");
        w.strDES_TPL_CON = rs.getString("DES_TPL_CON");
        ar.add(w);
      }
      return ar;
    } catch (Exception ex) {
      throw new EJBException(ex);
    } finally {
      bmp.close();
    }
  }
 public Collection ejbGetComboView() {
   BMPConnection bmp = getConnection();
   try {
     PreparedStatement ps =
         bmp.prepareStatement(
             "SELECT cod_TPL_CON, nom_TPL_CON, des_TPL_CON FROM TPL_CON_tab ORDER BY nom_TPL_CON");
     ResultSet rs = ps.executeQuery();
     java.util.ArrayList ar = new java.util.ArrayList();
     while (rs.next()) {
       TipologiaContratti_View w = new TipologiaContratti_View();
       w.lCOD_TPL_CON = rs.getLong("COD_TPL_CON");
       w.strNOM_TPL_CON = rs.getString("NOM_TPL_CON");
       w.strDES_TPL_CON = rs.getString("DES_TPL_CON");
       ar.add(w);
     }
     return ar;
   } catch (Exception ex) {
     throw new EJBException(ex);
   } finally {
     bmp.close();
   }
 }
 public Collection ejbGetTipologia_View() {
   BMPConnection bmp = getConnection();
   try {
     PreparedStatement ps =
         bmp.prepareStatement(
             "select cod_tpl_con, nom_tpl_con, des_tpl_con from tpl_con_tab  order by  nom_tpl_con ");
     ResultSet rs = ps.executeQuery();
     java.util.ArrayList al = new java.util.ArrayList();
     while (rs.next()) {
       TipologiaContratti_View obj = new TipologiaContratti_View();
       obj.lCOD_TPL_CON = rs.getLong(1);
       obj.strNOM_TPL_CON = rs.getString(2);
       obj.strDES_TPL_CON = rs.getString(3);
       al.add(obj);
     }
     bmp.close();
     return al;
   } catch (Exception ex1) {
     throw new EJBException(ex1);
   } finally {
     bmp.close();
   }
 }