From: Roland Häder Date: Sun, 19 Apr 2020 06:27:51 +0000 (+0200) Subject: Product-only: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3de249807ceddf963ca6cc6be5e059018bf9ce4a;p=pizzaservice-ejb.git Product-only: - set productEntryUpdated when update business method has finished - detachedProduct is misleading as it is a managed (JPA) instance Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/jproduct/model/product/PizzaAdminGenericProductSessionBean.java b/src/java/org/mxchange/jproduct/model/product/PizzaAdminGenericProductSessionBean.java index c82ecd5..3bc68ce 100644 --- a/src/java/org/mxchange/jproduct/model/product/PizzaAdminGenericProductSessionBean.java +++ b/src/java/org/mxchange/jproduct/model/product/PizzaAdminGenericProductSessionBean.java @@ -101,7 +101,7 @@ public class PizzaAdminGenericProductSessionBean extends BasePizzaProductEnterpr } // Set created instance - product.setProductCreated(new Date()); + product.setProductEntryCreated(new Date()); // Persist it this.getEntityManager().persist(product); @@ -134,13 +134,16 @@ public class PizzaAdminGenericProductSessionBean extends BasePizzaProductEnterpr } // 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; } /** diff --git a/src/java/org/mxchange/pizzaapplication/enterprise/product/BasePizzaProductEnterpriseBean.java b/src/java/org/mxchange/pizzaapplication/enterprise/product/BasePizzaProductEnterpriseBean.java index dbb93bc..def6fa5 100644 --- a/src/java/org/mxchange/pizzaapplication/enterprise/product/BasePizzaProductEnterpriseBean.java +++ b/src/java/org/mxchange/pizzaapplication/enterprise/product/BasePizzaProductEnterpriseBean.java @@ -124,7 +124,7 @@ public abstract class BasePizzaProductEnterpriseBean extends BasePizzaEnterprise *

* @param detachedProduct Product instance to merge *

- * @return Detached product instance + * @return Managed product instance */ protected Product mergeProductData (final Product detachedProduct) { // Trace message