detachedProduct.setProductEntryUpdated(new Date());
// Get product from it and find it
- final Product foundProduct = this.getEntityManager().find(detachedProduct.getClass(), detachedProduct.getProductId());
-
- // Should be found
- assert (foundProduct instanceof Product) : MessageFormat.format("Product with id {0} not found, but should be.", detachedProduct.getProductId()); //NOI18N
+ final Product foundProduct = this.createManaged(detachedProduct);
// Debug message
this.getLoggerBeanLocal().logDebug(MessageFormat.format("mergeProductData: foundProduct.productId={0}", foundProduct.getProductId())); //NOI18N
detachedCategory.setCategoryEntryUpdated(new Date());
// Get category from it and find it
- final Category foundCategory = this.getEntityManager().find(detachedCategory.getClass(), detachedCategory.getCategoryId());
-
- // Should be found
- assert (foundCategory instanceof Category) : MessageFormat.format("Category with id {0} not found, but should be.", detachedCategory.getCategoryId()); //NOI18N
+ final Category foundCategory = this.createManaged(detachedCategory);
// Debug message
this.getLoggerBeanLocal().logDebug(MessageFormat.format("mergeCategoryData: foundCategory.categoryId={0}", foundCategory.getCategoryId())); //NOI18N
}
// Update instance
- final Category updatedCategory = this.mergeProductCategoryData(category);
+ final Category managedCategory = this.mergeProductCategoryData(category);
// Trace message
- this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateProductCategory: updatedCategory.categoryId={1} - EXIT!", this.getClass().getSimpleName(), updatedCategory.getCategoryId())); //NOI18N
+ this.getLoggerBeanLocal().logTrace(MessageFormat.format("{0}.updateProductCategory: managedCategory.categoryId={1} - EXIT!", this.getClass().getSimpleName(), managedCategory.getCategoryId())); //NOI18N
// Return it
- return updatedCategory;
+ return managedCategory;
}
/**