From: Roland Haeder Date: Fri, 11 Mar 2016 21:03:17 +0000 (+0100) Subject: Some cascade/fetch cleanups: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=715becedefb6519fabc07b2a37fb1a55eeaace2a;p=jcustomer-core.git Some cascade/fetch cleanups: - CascadeType.MERGE is basicly an UPDATE statement, it needs to be REFRESH (from database to local entity object) - Fetch strategy EAGER is default, no need to specify it - updated jar(s) --- diff --git a/src/org/mxchange/jshopcore/model/basket/items/BasketItem.java b/src/org/mxchange/jshopcore/model/basket/items/BasketItem.java index fb5fd00..78fb208 100644 --- a/src/org/mxchange/jshopcore/model/basket/items/BasketItem.java +++ b/src/org/mxchange/jshopcore/model/basket/items/BasketItem.java @@ -56,7 +56,7 @@ public class BasketItem extends BaseItem implements AddableBasketItem, Comparabl * Product instance */ @JoinColumn (name = "product_id", updatable = false) - @OneToOne (targetEntity = GenericProduct.class, cascade = CascadeType.MERGE) + @OneToOne (targetEntity = GenericProduct.class, cascade = CascadeType.REFRESH) private Product itemProduct; /** diff --git a/src/org/mxchange/jshopcore/model/category/ProductCategory.java b/src/org/mxchange/jshopcore/model/category/ProductCategory.java index 721e638..0e94427 100644 --- a/src/org/mxchange/jshopcore/model/category/ProductCategory.java +++ b/src/org/mxchange/jshopcore/model/category/ProductCategory.java @@ -61,7 +61,7 @@ public class ProductCategory implements Category, Comparable { * Parent category */ @JoinColumn (name = "parent_id") - @OneToOne (targetEntity = ProductCategory.class, cascade = CascadeType.MERGE) + @OneToOne (targetEntity = ProductCategory.class, cascade = CascadeType.REFRESH) private Category parentCategory; /** diff --git a/src/org/mxchange/jshopcore/model/customer/status/CustomerAccountStatus.java b/src/org/mxchange/jshopcore/model/customer/status/CustomerAccountStatus.java index 1637f8a..1606ac5 100644 --- a/src/org/mxchange/jshopcore/model/customer/status/CustomerAccountStatus.java +++ b/src/org/mxchange/jshopcore/model/customer/status/CustomerAccountStatus.java @@ -19,7 +19,7 @@ package org.mxchange.jshopcore.model.customer.status; import java.io.Serializable; /** - * An enum for customer's account status like confirmed, locked, etc. + * An enumeration for customer's account status like confirmed, locked, etc. *

* @author Roland Haeder */ @@ -36,7 +36,7 @@ public enum CustomerAccountStatus implements Serializable { CONFIRMED("CUSTOMER_ACCOUNT_STATUS_CONFIRMED"), //NOI18N /** - * Locked (maybe violeted T&C) + * Locked (maybe violated T&C) */ LOCKED("CUSTOMER_ACCOUNT_STATUS_LOCKED"); //NOI18N diff --git a/src/org/mxchange/jshopcore/model/order/ShopOrder.java b/src/org/mxchange/jshopcore/model/order/ShopOrder.java index 2fe383f..51acec5 100644 --- a/src/org/mxchange/jshopcore/model/order/ShopOrder.java +++ b/src/org/mxchange/jshopcore/model/order/ShopOrder.java @@ -60,7 +60,7 @@ public class ShopOrder implements Orderable, Comparable { * Customer instance */ @JoinColumn (name = "customer_id", nullable = false, updatable = false) - @OneToOne (targetEntity = ShopCustomer.class, cascade = CascadeType.MERGE, optional = false) + @OneToOne (targetEntity = ShopCustomer.class, cascade = CascadeType.REFRESH, optional = false) private Customer customer; /** diff --git a/src/org/mxchange/jshopcore/model/order/items/OrderItem.java b/src/org/mxchange/jshopcore/model/order/items/OrderItem.java index f16c660..23f2ab1 100644 --- a/src/org/mxchange/jshopcore/model/order/items/OrderItem.java +++ b/src/org/mxchange/jshopcore/model/order/items/OrderItem.java @@ -71,7 +71,7 @@ public class OrderItem extends BaseItem implements AddableBasketItem, Comparable * Product instance */ @JoinColumn (name = "order_product_id", updatable = false) - @OneToOne (targetEntity = GenericProduct.class, cascade = CascadeType.MERGE) + @OneToOne (targetEntity = GenericProduct.class, cascade = CascadeType.REFRESH) private Product product; /** diff --git a/src/org/mxchange/jshopcore/model/product/GenericProduct.java b/src/org/mxchange/jshopcore/model/product/GenericProduct.java index 8a3fedb..05fba51 100644 --- a/src/org/mxchange/jshopcore/model/product/GenericProduct.java +++ b/src/org/mxchange/jshopcore/model/product/GenericProduct.java @@ -55,7 +55,7 @@ public class GenericProduct implements Product, Comparable { * Product productCategory */ @JoinColumn (name = "category_id", nullable = false, updatable = false) - @OneToOne (targetEntity = ProductCategory.class, cascade = CascadeType.MERGE, optional = false) + @OneToOne (targetEntity = ProductCategory.class, cascade = CascadeType.REFRESH, optional = false) private Category productCategory; /**