10,606
社区成员
发帖
与我相关
我的任务
分享
public void unPost(PaymentIn payment) throws Exception {
try {
this.em
.createQuery(
"delete from AccDoc t "
+ " where t.docUuid = :invoiceUuid")
.setParameter("invoiceUuid", payment.getUuid())
.executeUpdate();
payment.setPosted(false);
this.em.merge(payment);
} catch (Exception e) {
if (e.getCause() != null
&& e.getCause() instanceof SQLIntegrityConstraintViolationException) {
throw new RuntimeException(
"Cannot unpost document `"
+ payment.getCode()
+ "`. The corresponding accounting document is already posted to great ledger.");
} else {
throw e;
}
}
}