コード例 #1
0
 @Override
 public void save(Payment payment) {
   if (payment.getId() == 0) {
     em.persist(payment);
     log.debug("The payment with id=" + payment.getId() + " has been persisted.");
   } else {
     em.merge(payment);
     log.debug("The payment with id=" + payment.getId() + " has been merged.");
   }
 }
コード例 #2
0
 @Override
 public void remove(int id) {
   Payment payment = em.find(Payment.class, id);
   if (payment != null) {
     em.remove(payment);
     log.debug("The payment with id=" + payment.getId() + " has been removed.");
   }
 }