]> git.mxchange.org Git - jproduct-core.git/commitdiff
added missing cascade type, at least MERGE
authorRoland Haeder <roland@mxchange.org>
Fri, 16 Oct 2015 11:14:25 +0000 (13:14 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 16 Oct 2015 11:14:25 +0000 (13:14 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

src/org/mxchange/jshopcore/model/basket/items/BasketItem.java
src/org/mxchange/jshopcore/model/category/ProductCategory.java
src/org/mxchange/jshopcore/model/customer/ShopCustomer.java
src/org/mxchange/jshopcore/model/order/ShopOrder.java
src/org/mxchange/jshopcore/model/order/items/OrderItem.java
src/org/mxchange/jshopcore/model/product/GenericProduct.java

index 83775c3db68e6f07a4781b18bed059c98fa37ecc..57a2c43fc8e2a814c98c68ff77fdcc95202d853e 100644 (file)
@@ -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;
 
        /**
index c5b055f7330411acce96091a0027010a48eb988a..003da6b36d76ba2c579f952d292c358651321220 100644 (file)
@@ -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<Category> {
         * Parent category
         */
        @JoinColumn (name = "parent_id")
-       @OneToOne (targetEntity = ProductCategory.class)
+       @OneToOne (targetEntity = ProductCategory.class, cascade = CascadeType.MERGE)
        private Category parentCategory;
 
        /**
index b52754b679d5b96b4beec8b54729b8fa4d7e488b..2db4c227f8e6c7ab13b1a23424dccaba509ccec0 100644 (file)
@@ -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;
 
        /**
index c0757c4c8c6d31b55bfdaf0287259c0c94a56908..66b75e0c9dec1d063a8452b7cf2624fbcb6c4918 100644 (file)
@@ -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;
 
        /**
index c1783fb639ef0b2ff27e364b74da752cb55ac0bf..e07bbf7c7b0630fd5a52456f6d7eefb6f073ff24 100644 (file)
@@ -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;
 
        /**
index a2daad10022266a88f5a87f30ecf433ff2086a1a..45bca2106df1a3d113bcb7a98ea12e3ced3bc226 100644 (file)
@@ -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> {
         * 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;
 
        /**