From a387f984565a76bfe692d36f0c7ee74dd76ad329 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Sun, 19 Apr 2020 08:27:51 +0200 Subject: [PATCH] Product-only: - set productEntryUpdated when update business method has finished - detachedProduct is misleading as it is a managed (JPA) instance MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../product/BaseFinancialsProductEnterpriseBean.java | 2 +- .../FinancialsAdminGenericProductSessionBean.java | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/java/org/mxchange/jfinancials/enterprise/product/BaseFinancialsProductEnterpriseBean.java b/src/java/org/mxchange/jfinancials/enterprise/product/BaseFinancialsProductEnterpriseBean.java index 3c5788b..aee5522 100644 --- a/src/java/org/mxchange/jfinancials/enterprise/product/BaseFinancialsProductEnterpriseBean.java +++ b/src/java/org/mxchange/jfinancials/enterprise/product/BaseFinancialsProductEnterpriseBean.java @@ -124,7 +124,7 @@ public abstract class BaseFinancialsProductEnterpriseBean extends BaseFinancials *

* @param detachedProduct Product instance to merge *

- * @return Detached product instance + * @return Managed product instance */ protected Product mergeProductData (final Product detachedProduct) { // Trace message diff --git a/src/java/org/mxchange/jproduct/model/product/FinancialsAdminGenericProductSessionBean.java b/src/java/org/mxchange/jproduct/model/product/FinancialsAdminGenericProductSessionBean.java index 982e458..4cd0816 100644 --- a/src/java/org/mxchange/jproduct/model/product/FinancialsAdminGenericProductSessionBean.java +++ b/src/java/org/mxchange/jproduct/model/product/FinancialsAdminGenericProductSessionBean.java @@ -101,7 +101,7 @@ public class FinancialsAdminGenericProductSessionBean extends BaseFinancialsProd } // Set created instance - product.setProductCreated(new Date()); + product.setProductEntryCreated(new Date()); // Persist it this.getEntityManager().persist(product); @@ -134,13 +134,16 @@ public class FinancialsAdminGenericProductSessionBean extends BaseFinancialsProd } // Merge data - final Product detachedProduct = this.mergeProductData(product); + final Product managedProduct = this.mergeProductData(product); + + // Set updated instance + managedProduct.setProductEntryUpdated(new Date()); // Trace message - this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateProductData: detachedProduct={1} - EXIT!", this.getClass().getSimpleName(), detachedProduct)); //NOI18N + this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateProductData: managedProduct={1} - EXIT!", this.getClass().getSimpleName(), managedProduct)); //NOI18N // Return it - return detachedProduct; + return managedProduct; } /** -- 2.39.5