Пример #1
0
 public void update(User entry) {
   jdbcTemplate.update(
       "UPDATE EM_USER SET NAME=?, EMAIL=?, BIRTH_DATE=?, EM_ROLES=?, EM_PASSWORD=?, MONEY=? WHERE ID=?",
       entry.getName(),
       entry.getEmail(),
       entry.getBirthDate(),
       entry.getRoles(),
       entry.getPassword(),
       entry.getMoney(),
       entry.getId());
   if (entry.getPurchasedTickets() != null) {
     for (Ticket ticket : entry.getPurchasedTickets()) {
       int occasionId = ticket.getOccasion().getId();
       jdbcTemplate.update(
           "UPDATE TICKET SET USER_ID=? WHERE OCCASION_ID=? AND SEAT=?",
           entry.getId(),
           occasionId,
           ticket.getSeat());
     }
   }
 }
Пример #2
0
 public void delete(User entry) {
   jdbcTemplate.update("DELETE FROM EM_USER WHERE ID=?", entry.getId());
 }