*/
@Entity (name = "customer")
@Table (name = "customer")
+@SuppressWarnings ("PersistenceUnitPresent")
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
*/
@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
*/
@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());
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;
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;