/** * Inserts a single row of Concept Derivation Rule and returns primary key condr_IDSEQ * * @param condrVO * @param conn * @return * @throws DBException */ public String insert(BaseVO vO, Connection conn) throws DBException { CondrVO condrVO = (CondrVO) vO; PreparedStatement statement = null; String primaryKey = null; // generate condr_IDSEQ(primary key) condrVO.setCondr_IDSEQ(this.generatePrimaryKey(conn)); try { String sql = "insert into sbrext.con_derivation_rules_view_ext(condr_idseq, crtl_name, name) values(?,?,?)"; int column = 0; statement = conn.prepareStatement(sql); statement.setString(++column, condrVO.getCondr_IDSEQ()); statement.setString(++column, condrVO.getCrtl_name()); statement.setString(++column, condrVO.getName()); int count = statement.executeUpdate(); if (count == 0) { throw new Exception("Unable to insert the record"); } else { primaryKey = condrVO.getCondr_IDSEQ(); if (logger.isDebugEnabled()) { logger.debug("Inserted Condr"); logger.debug("condr_IDSEQ(primary key )-----> " + primaryKey); } } } catch (Exception e) { logger.error("Error inserting Condr " + e); // errorList.add("Error inserting Condr "); throw new DBException(errorList); } finally { statement = SQLHelper.closePreparedStatement(statement); } return primaryKey; }