@Override public boolean update(UserActionComment userActionComment) throws DaoException { Connection connection = daoFactory.getConnection(); DaoUtil.executeUpdate( connection, "UPDATE UserActionComments SET comments_id = ?, useractions_id = ? WHERE id = ?", userActionComment.getComment().getId(), userActionComment.getUserAction().getId(), userActionComment.getId()); return true; }
@Override public boolean insert(UserActionComment userActionComment) throws DaoException { Connection connection = daoFactory.getConnection(); int rowId = DaoUtil.executeUpdate( connection, "INSERT INTO UserActionComments (comments_id, useractions_id) VALUES (?, ?)", userActionComment.getComment().getId(), userActionComment.getUserAction().getId()); userActionComment.setId(rowId); return true; }
@Override public boolean delete(UserActionComment userActionComment) throws DaoException { Connection connection = daoFactory.getConnection(); DaoUtil.executeUpdate( connection, "DELETE FROM UserActionComments WHERE id = ?", userActionComment.getId()); return true; }
@Override public Object map(ResultSet rs) throws SQLException { UserActionComment userActionComment = new UserActionComment(); userActionComment.setId(rs.getInt(1)); Comment comment = new Comment(); comment.setId(rs.getInt(2)); userActionComment.setComment(comment); UserAction userAction = new UserAction(); userAction.setId(rs.getInt(3)); userActionComment.setUserAction(userAction); userActionComment.setUpdatedAt(rs.getDate(4)); userActionComment.setCreatedAt(rs.getDate(5)); return userActionComment; }