From 6a9a2ad4b7556c3354a1eadf85555ba12743ddb2 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Tue, 12 Apr 2016 19:06:54 +0200 Subject: [PATCH] Hmm, it may not be good if the object sets its own creation timestamp as this may cause data loss. As EJBs are not creating POJO (but controllers), please make sure your EJB sets the creation timestamp (new GregorianCalendar()). --- .../jcontacts/contact/UserContact.java | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/src/org/mxchange/jcontacts/contact/UserContact.java b/src/org/mxchange/jcontacts/contact/UserContact.java index b59ef70..8aeda22 100644 --- a/src/org/mxchange/jcontacts/contact/UserContact.java +++ b/src/org/mxchange/jcontacts/contact/UserContact.java @@ -19,7 +19,6 @@ package org.mxchange.jcontacts.contact; import java.util.Calendar; import java.util.Date; import java.util.Objects; -import javax.annotation.PostConstruct; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; @@ -209,6 +208,17 @@ public class UserContact implements Contact { @Column (name = "contact_zip_code", nullable = false, length = 6) private Integer contactZipCode; + /** + * Default constructor + */ + public UserContact () { + // Default is not user's own contact + this.contactOwnContact = Boolean.FALSE; + + // Unknown gender + this.contactGender = Gender.UNKNOWN; + } + /** * Constructor for contactGender and names *

@@ -217,7 +227,7 @@ public class UserContact implements Contact { * @param contactFamilyName Family name */ public UserContact (final Gender contactGender, final String contactFirstName, final String contactFamilyName) { - // Call other constructor + // Call default constructor this(); // Set all @@ -226,14 +236,6 @@ public class UserContact implements Contact { this.contactFamilyName = contactFamilyName; } - /** - * Default constructor - */ - public UserContact () { - // Default is not user's own contact - this.contactOwnContact = Boolean.FALSE; - } - @Override public void copyAll (final Contact contact) { // Copy all: @@ -475,15 +477,6 @@ public class UserContact implements Contact { this.contactZipCode = contactZipCode; } - /** - * Initialization with fake contactGender UNKNOWN - */ - @PostConstruct - public void init () { - // Fake contactGender - this.contactGender = Gender.UNKNOWN; - } - @Override public Boolean isOwnContact () { return this.contactOwnContact; -- 2.39.5