Exemplo n.º 1
0
 @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());
 }
Exemplo n.º 2
0
 @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());
 }