From 0958b9902f4edaf813cb3e2c00d497c8f2702909 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 24 Apr 2020 17:03:39 +0200 Subject: [PATCH] Don't cherry-pick: - ops, don't update itemEntryCreated in update phase, why is that still possible?! - set itemEntryUpdated when update business method is invoked MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../BaseFinancialsProjectEnterpriseBean.java | 4 ++++ .../receipt/FinancialAdminReceiptSessionBean.java | 12 +++--------- .../FinancialAdminReceiptItemSessionBean.java | 2 +- .../FinancialReceiptItemSessionBean.java | 2 +- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/java/org/mxchange/jfinancials/enterprise/financial/BaseFinancialsProjectEnterpriseBean.java b/src/java/org/mxchange/jfinancials/enterprise/financial/BaseFinancialsProjectEnterpriseBean.java index 9e3f3e3..211200a 100644 --- a/src/java/org/mxchange/jfinancials/enterprise/financial/BaseFinancialsProjectEnterpriseBean.java +++ b/src/java/org/mxchange/jfinancials/enterprise/financial/BaseFinancialsProjectEnterpriseBean.java @@ -17,6 +17,7 @@ package org.mxchange.jfinancials.enterprise.financial; import java.text.MessageFormat; +import java.util.Date; import org.mxchange.jfinancials.enterprise.BaseFinancialsEnterpriseBean; import org.mxchange.jfinancials.model.receipt.BillableReceipt; import org.mxchange.jfinancials.model.receipt.Receipts; @@ -80,6 +81,9 @@ public abstract class BaseFinancialsProjectEnterpriseBean extends BaseFinancials // Merge receipt instance final BillableReceipt managedReceipt = this.getEntityManager().merge(foundReceipt); + // Set updated timestamp + managedReceipt.setReceiptUpdated(new Date()); + // Trace message this.getLoggerBeanLocal().logTrace(MessageFormat.format("mergeReceipt: managedReceipt={0} - EXIT!", managedReceipt)); //NOI18N diff --git a/src/java/org/mxchange/jfinancials/model/receipt/FinancialAdminReceiptSessionBean.java b/src/java/org/mxchange/jfinancials/model/receipt/FinancialAdminReceiptSessionBean.java index c68362e..05030ba 100644 --- a/src/java/org/mxchange/jfinancials/model/receipt/FinancialAdminReceiptSessionBean.java +++ b/src/java/org/mxchange/jfinancials/model/receipt/FinancialAdminReceiptSessionBean.java @@ -152,9 +152,6 @@ public class FinancialAdminReceiptSessionBean extends BaseFinancialsProjectEnter throw new ReceiptNotFoundException(receipt); } - // Add created instance - receipt.setReceiptCreated(new Date()); - // Is user instance set? if (receipt.getReceiptUser() instanceof User) { // Then get managed instanced @@ -173,17 +170,14 @@ public class FinancialAdminReceiptSessionBean extends BaseFinancialsProjectEnter receipt.setReceiptSellerEmployee(managedEmployee); } - // Set updated timestamp - receipt.setReceiptUpdated(new Date()); - // Merge data - final BillableReceipt detachedReceipt = this.mergeReceipt(receipt); + final BillableReceipt managedReceipt = this.mergeReceipt(receipt); // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateReceipt(): detachedReceipt.receiptId={1} - EXIT!", this.getClass().getSimpleName(), detachedReceipt.getReceiptId())); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateReceipt(): managedReceipt.receiptId={1} - EXIT!", this.getClass().getSimpleName(), managedReceipt.getReceiptId())); //NOI18N // Return it - return detachedReceipt; + return managedReceipt; } } diff --git a/src/java/org/mxchange/jfinancials/model/receipt_item/FinancialAdminReceiptItemSessionBean.java b/src/java/org/mxchange/jfinancials/model/receipt_item/FinancialAdminReceiptItemSessionBean.java index e3961b5..a2fd026 100644 --- a/src/java/org/mxchange/jfinancials/model/receipt_item/FinancialAdminReceiptItemSessionBean.java +++ b/src/java/org/mxchange/jfinancials/model/receipt_item/FinancialAdminReceiptItemSessionBean.java @@ -98,7 +98,7 @@ public class FinancialAdminReceiptItemSessionBean extends BaseFinancialsProductE } // Add created timestamp - receiptItem.setItemCreated(new Date()); + receiptItem.setItemEntryCreated(new Date()); // Persist it this.getEntityManager().persist(receiptItem); diff --git a/src/java/org/mxchange/jfinancials/model/receipt_item/FinancialReceiptItemSessionBean.java b/src/java/org/mxchange/jfinancials/model/receipt_item/FinancialReceiptItemSessionBean.java index fe0ede0..5b5d4e2 100644 --- a/src/java/org/mxchange/jfinancials/model/receipt_item/FinancialReceiptItemSessionBean.java +++ b/src/java/org/mxchange/jfinancials/model/receipt_item/FinancialReceiptItemSessionBean.java @@ -78,7 +78,7 @@ public class FinancialReceiptItemSessionBean extends BaseFinancialsEnterpriseBea } // Add created timestamp - receiptItem.setItemCreated(new Date()); + receiptItem.setItemEntryCreated(new Date()); // Persist it this.getEntityManager().persist(receiptItem); -- 2.39.5