コード例 #1
0
 public boolean bookTicket(User user, Ticket ticket) {
   if (!isBooked(ticket)) {
     Object[] params = {
       eventAuditoriumDAO.getId(ticket.getEventAuditorium()), user.getId(), ticket.getSeat()
     };
     jdbcTemplateEmbedded.update(BOOK_TICKET, params);
     return true;
   } else {
     return false;
   }
 }
コード例 #2
0
 private boolean isBooked(Ticket ticket) {
   Object[] params = {eventAuditoriumDAO.getId(ticket.getEventAuditorium()), ticket.getSeat()};
   return jdbcTemplateEmbedded.queryForObject(BOOKED_FOR_USER, params, Integer.class) > 0;
 }