Exemplo n.º 1
0
 public void create(User entry) {
   jdbcTemplate.update(
       "INSERT INTO EM_USER(NAME, EMAIL, BIRTH_DATE, EM_ROLES, EM_PASSWORD, MONEY) VALUES(?,?,?,?,?,?)",
       entry.getName(),
       entry.getEmail(),
       entry.getBirthDate(),
       entry.getRoles(),
       entry.getPassword(),
       entry.getMoney());
 }
Exemplo n.º 2
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());
     }
   }
 }