Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- final String INSERTFROM = "INSERT INTO priorities " +
- "(callId, priorityNum, employeeCod) " +
- "SELECT callId, priorityNum, employeeCod " +
- "FROM calls WHERE callId=?"; // note WHERE here
- @Override
- public void insert(Priority o) throws DAOException {
- try{
- pstm = con.prepareStatement(INSERTFROM);
- /* / error under */
- pstm.setInt(1, o.getCallId());
- // no need in setting other values, since they are copied
- // from the calls table
- if(pstm.executeUpdate() == 0 ){
- throw new DAOException("The update couldn't been saved");
- }
- } catch (SQLException ex) {
- /* And it stops here */
- throw new DAOException("SQL Error", ex);
- } finally {
- if(pstm != null){
- try {
- pstm.close();
- } catch (SQLException ex) {
- throw new DAOException("Error to close connection", ex);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement