From: Roland Häder Date: Fri, 24 Apr 2020 15:03:39 +0000 (+0200) Subject: Don't cherry-pick: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=0958b9902f4edaf813cb3e2c00d497c8f2702909;p=jfinancials-ejb.git 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 Signed-off-by: Roland Häder --- 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);