From f3da3017282330fc75a32454c917f92aae88ba67 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Wed, 20 May 2020 20:37:11 +0200 Subject: [PATCH] Don't cherry-pick: - always set EntryUpdated in the managed (and merged) instance, as the copyFooData() methods do no longer copy timestamps MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../receipt/BaseFinancialsReceiptEnterpriseBean.java | 9 ++++++--- .../BaseFinancialsReceiptItemEnterpriseBean.java | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/java/org/mxchange/jfinancials/enterprise/financial/receipt/BaseFinancialsReceiptEnterpriseBean.java b/src/java/org/mxchange/jfinancials/enterprise/financial/receipt/BaseFinancialsReceiptEnterpriseBean.java index a36c4ca..92864cf 100644 --- a/src/java/org/mxchange/jfinancials/enterprise/financial/receipt/BaseFinancialsReceiptEnterpriseBean.java +++ b/src/java/org/mxchange/jfinancials/enterprise/financial/receipt/BaseFinancialsReceiptEnterpriseBean.java @@ -64,9 +64,6 @@ public abstract class BaseFinancialsReceiptEnterpriseBean extends BaseFinancials throw new IllegalStateException(MessageFormat.format("detachedReceipt.receiptId={0} is not valid.", detachedReceipt.getReceiptId())); //NOI18N } - // Set updated timestamp - detachedReceipt.setReceiptEntryUpdated(new Date()); - // Get receipt from it and find it final BillableReceipt foundReceipt = this.getEntityManager().find(detachedReceipt.getClass(), detachedReceipt.getReceiptId()); @@ -82,6 +79,12 @@ public abstract class BaseFinancialsReceiptEnterpriseBean extends BaseFinancials // Merge receipt instance final BillableReceipt managedReceipt = this.getEntityManager().merge(foundReceipt); + // Should be there + assert (managedReceipt instanceof BillableReceipt) : "managedReceipt is null"; //NOI18N + + // Set updated timestamp + managedReceipt.setReceiptEntryUpdated(new Date()); + // Trace message this.getLoggerBeanLocal().logTrace(MessageFormat.format("mergeReceipt: managedReceipt={0} - EXIT!", managedReceipt)); //NOI18N diff --git a/src/java/org/mxchange/jfinancials/enterprise/financial/receipt_item/BaseFinancialsReceiptItemEnterpriseBean.java b/src/java/org/mxchange/jfinancials/enterprise/financial/receipt_item/BaseFinancialsReceiptItemEnterpriseBean.java index cf4ac8a..719a028 100644 --- a/src/java/org/mxchange/jfinancials/enterprise/financial/receipt_item/BaseFinancialsReceiptItemEnterpriseBean.java +++ b/src/java/org/mxchange/jfinancials/enterprise/financial/receipt_item/BaseFinancialsReceiptItemEnterpriseBean.java @@ -64,9 +64,6 @@ public abstract class BaseFinancialsReceiptItemEnterpriseBean extends BaseFinanc throw new IllegalStateException(MessageFormat.format("detachedReceipt.itemId={0} is not valid.", detachedReceiptItem.getItemId())); //NOI18N } - // Set updated timestamp - detachedReceiptItem.setItemEntryUpdated(new Date()); - // Get receipt from it and find it final BillableReceiptItem foundReceiptItem = this.getEntityManager().find(detachedReceiptItem.getClass(), detachedReceiptItem.getItemId()); @@ -82,6 +79,12 @@ public abstract class BaseFinancialsReceiptItemEnterpriseBean extends BaseFinanc // Merge receipt item instance final BillableReceiptItem managedReceiptItem = this.getEntityManager().merge(foundReceiptItem); + // Should be there + assert (managedReceiptItem instanceof BillableReceiptItem) : "managedReceiptItem is null"; //NOI18N + + // Set updated timestamp + managedReceiptItem.setItemEntryUpdated(new Date()); + // Trace message this.getLoggerBeanLocal().logTrace(MessageFormat.format("mergeReceiptItem: managedReceiptItem={0} - EXIT!", managedReceiptItem)); //NOI18N -- 2.39.5