@Override public Long insert(User user) { return jdbcTemplate.queryForObject( "INSERT INTO users (role, username, password)" + " VALUES (?,?,?) returning id", new Object[] {user.getRole().name(), user.getUsername(), user.getPassword()}, new IdMapper()); }
@Override public void update(User user) { jdbcTemplate.update( "UPDATE users " + "SET role=?, username=?, password=?" + " WHERE id=?", user.getRole().name(), user.getUsername(), user.getPassword(), user.getId()); }