From: Roland Haeder Date: Wed, 27 Apr 2016 20:29:32 +0000 (+0200) Subject: Continued with lib upgrade: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=1d1be17008a650ab3eb6ff2125d3207d1651e62b;p=jproduct-core.git Continued with lib upgrade: - new property/field name is customerContact (more specific) - suppressed warning about missing persistence unit because this is only entities lib - sorted members --- diff --git a/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java b/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java index 1fb9cc1..3fac843 100644 --- a/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java +++ b/src/org/mxchange/jshopcore/model/customer/ShopCustomer.java @@ -44,6 +44,7 @@ import org.mxchange.jcustomercore.model.customer.status.CustomerAccountStatus; */ @Entity (name = "customer") @Table (name = "customer") +@SuppressWarnings ("PersistenceUnitPresent") public class ShopCustomer implements Customer { /** @@ -51,13 +52,6 @@ public class ShopCustomer implements Customer { */ private static final long serialVersionUID = 4_328_454_581_751L; - /** - * Id number from "contacts" table - */ - @JoinColumn (name = "contact_id", nullable = false, updatable = false, unique = true) - @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.ALL, optional = false) - private Contact contact; - /** * Account status */ @@ -72,6 +66,13 @@ public class ShopCustomer implements Customer { @Column (name = "customer_confirm_key", length = 50) private String customerConfirmKey; + /** + * Id number from "contacts" table + */ + @JoinColumn (name = "contact_id", nullable = false, updatable = false, unique = true) + @OneToOne (targetEntity = UserContact.class, cascade = CascadeType.ALL, optional = false) + private Contact customerContact; + /** * "created" timestamp */ @@ -115,8 +116,8 @@ public class ShopCustomer implements Customer { @Override public void copyAll (final Customer customer) { - // Copy also contact data - this.getContact().copyAll(customer.getContact()); + // Copy also customerContact data + this.getCustomerContact().copyAll(customer.getCustomerContact()); // Copy other data this.setCustomerConfirmKey(customer.getCustomerConfirmKey()); @@ -141,32 +142,22 @@ public class ShopCustomer implements Customer { if (!Objects.equals(this.getCustomerNumber(), other.getCustomerNumber())) { return false; - } else if (!Objects.equals(this.getContact(), other.getContact())) { + } else if (!Objects.equals(this.getCustomerContact(), other.getCustomerContact())) { return false; } - return Objects.equals(this.getContact(), other.getContact()); + return Objects.equals(this.getCustomerContact(), other.getCustomerContact()); } @Override public int hashCode () { int hash = 3; - hash = 17 * hash + Objects.hashCode(this.getContact()); + hash = 17 * hash + Objects.hashCode(this.getCustomerContact()); hash = 17 * hash + Objects.hashCode(this.getCustomerId()); hash = 17 * hash + Objects.hashCode(this.getCustomerNumber()); return hash; } - @Override - public Contact getContact () { - return this.contact; - } - - @Override - public void setContact (final Contact contact) { - this.contact = contact; - } - @Override public CustomerAccountStatus getCustomerAccountStatus () { return this.customerAccountStatus; @@ -187,6 +178,16 @@ public class ShopCustomer implements Customer { this.customerConfirmKey = customerConfirmKey; } + @Override + public Contact getCustomerContact () { + return this.customerContact; + } + + @Override + public void setCustomerContact (final Contact customerContact) { + this.customerContact = customerContact; + } + @Override public Calendar getCustomerCreated () { return this.customerCreated;