]> git.mxchange.org Git - pizzaservice-ejb.git/commitdiff
Product-only:
authorRoland Häder <roland@mxchange.org>
Wed, 20 May 2020 18:36:39 +0000 (20:36 +0200)
committerRoland Häder <roland@mxchange.org>
Wed, 10 Jun 2020 17:23:17 +0000 (19:23 +0200)
- always set EntryUpdated in the managed (and merged) instance, as the
  copyFooData() methods do no longer copy timestamps

Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/pizzaapplication/enterprise/product/BasePizzaProductEnterpriseBean.java

index 59f79d2f7b7f4a16069e61f89331b24e0cc522fe..cc0440d8e8cfc337ee475693e15ee67fd69a0cc1 100644 (file)
@@ -142,9 +142,6 @@ public abstract class BasePizzaProductEnterpriseBean extends BasePizzaEnterprise
                        throw new IllegalStateException(MessageFormat.format("detachedProduct.productId={0} is not valid.", detachedProduct.getProductId())); //NOI18N
                }
 
-               // Set updated timestamp
-               detachedProduct.setProductEntryUpdated(new Date());
-
                // Get product from it and find it
                final Product foundProduct = this.createManaged(detachedProduct);
 
@@ -157,6 +154,12 @@ public abstract class BasePizzaProductEnterpriseBean extends BasePizzaEnterprise
                // Merge product instance
                final Product managedProduct = this.getEntityManager().merge(foundProduct);
 
+               // Should be there
+               assert (managedProduct instanceof Product) : "managedProduct is null"; //NOI18N
+
+               // Set updated timestamp
+               managedProduct.setProductEntryUpdated(new Date());
+
                // Trace message
                this.getLoggerBeanLocal().logTrace(MessageFormat.format("mergeProductData: managedProduct={0} - EXIT!", managedProduct)); //NOI18N