From: Roland Haeder Date: Fri, 16 Oct 2015 11:14:25 +0000 (+0200) Subject: added missing cascade type, at least MERGE X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=e83ea07a68440a9d435c5e5a65115f1242ad6d49;p=jshop-core.git added missing cascade type, at least MERGE Signed-off-by:Roland Häder --- diff --git a/src/org/mxchange/jshopcore/model/basket/items/BasketItem.java b/src/org/mxchange/jshopcore/model/basket/items/BasketItem.java index 83775c3..57a2c43 100644 --- a/src/org/mxchange/jshopcore/model/basket/items/BasketItem.java +++ b/src/org/mxchange/jshopcore/model/basket/items/BasketItem.java @@ -17,6 +17,7 @@ package org.mxchange.jshopcore.model.basket.items; import javax.persistence.Basic; +import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -69,7 +70,7 @@ public class BasketItem extends BaseItem implements AddableBasketItem { * Product instance */ @JoinColumn (name = "product_id", updatable = false) - @OneToOne (targetEntity = GenericProduct.class) + @OneToOne (targetEntity = GenericProduct.class, cascade = CascadeType.MERGE) private Product itemProduct; /** diff --git a/src/org/mxchange/jshopcore/model/category/ProductCategory.java b/src/org/mxchange/jshopcore/model/category/ProductCategory.java index c5b055f..003da6b 100644 --- a/src/org/mxchange/jshopcore/model/category/ProductCategory.java +++ b/src/org/mxchange/jshopcore/model/category/ProductCategory.java @@ -18,6 +18,7 @@ package org.mxchange.jshopcore.model.category; import java.util.Objects; import javax.persistence.Basic; +import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -53,7 +54,7 @@ public class ProductCategory implements Category, Comparable { * Parent category */ @JoinColumn (name = "parent_id") - @OneToOne (targetEntity = ProductCategory.class) + @OneToOne (targetEntity = ProductCategory.class, cascade = CascadeType.MERGE) private Category parentCategory; /** diff --git a/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java b/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java index b52754b..2db4c22 100644 --- a/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java +++ b/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java @@ -18,6 +18,7 @@ package org.mxchange.jshopcore.model.customer; import java.util.Calendar; import javax.persistence.Basic; +import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.EnumType; @@ -52,7 +53,7 @@ public class ShopCustomer implements Customer { * Id number from "contacts" table */ @JoinColumn (name = "contact_id", nullable = false, updatable = false, unique = true) - @OneToOne (targetEntity = UserContact.class, optional = false) + @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.ALL, optional = false) private Contact contact; /** diff --git a/src/org/mxchange/jshopcore/model/order/ShopOrder.java b/src/org/mxchange/jshopcore/model/order/ShopOrder.java index c0757c4..66b75e0 100644 --- a/src/org/mxchange/jshopcore/model/order/ShopOrder.java +++ b/src/org/mxchange/jshopcore/model/order/ShopOrder.java @@ -19,6 +19,7 @@ package org.mxchange.jshopcore.model.order; import java.util.Calendar; import java.util.List; import javax.persistence.Basic; +import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -67,7 +68,7 @@ public class ShopOrder implements Orderable { * Customer instance */ @JoinColumn (name = "customer_id", nullable = false, updatable = false) - @OneToOne (targetEntity = ShopCustomer.class, optional = false) + @OneToOne (targetEntity = ShopCustomer.class, cascade = CascadeType.MERGE, 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 c1783fb..e07bbf7 100644 --- a/src/org/mxchange/jshopcore/model/order/items/OrderItem.java +++ b/src/org/mxchange/jshopcore/model/order/items/OrderItem.java @@ -17,6 +17,7 @@ package org.mxchange.jshopcore.model.order.items; import javax.persistence.Basic; +import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -70,7 +71,7 @@ public class OrderItem extends BaseItem implements AddableBasketItem { * Product instance */ @JoinColumn (name = "product_id", updatable = false) - @OneToOne (targetEntity = GenericProduct.class) + @OneToOne (targetEntity = GenericProduct.class, cascade = CascadeType.MERGE) private Product product; /** diff --git a/src/org/mxchange/jshopcore/model/product/GenericProduct.java b/src/org/mxchange/jshopcore/model/product/GenericProduct.java index a2daad1..45bca21 100644 --- a/src/org/mxchange/jshopcore/model/product/GenericProduct.java +++ b/src/org/mxchange/jshopcore/model/product/GenericProduct.java @@ -18,6 +18,7 @@ package org.mxchange.jshopcore.model.product; import java.util.Objects; import javax.persistence.Basic; +import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -54,7 +55,7 @@ public class GenericProduct implements Product, Comparable { * Product productCategory */ @JoinColumn (name = "category_id", nullable = false, updatable = false) - @OneToOne (targetEntity = ProductCategory.class, optional = false) + @OneToOne (targetEntity = ProductCategory.class, cascade = CascadeType.MERGE, optional = false) private Category productCategory; /**