@Transient public void removeCreditCard(CreditCard creditCard) { boolean originalValue = creditCard.isEnabled(); try { creditCard.setEnabled(false); Dao.update(creditCard); } catch (HibernateException e) { creditCard.setEnabled(originalValue); } }
@Transient public void addCreditCard(CreditCard creditCard) { try { creditCard.setCustomer(this); creditCard.setEnabled(true); creditCards.add(creditCard); Dao.saveOrUpdate(creditCard); } catch (HibernateException e) { creditCard.setEnabled(false); } }