]> git.mxchange.org Git - pizzaservice-ejb.git/blobdiff - src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java
Some fixes:
[pizzaservice-ejb.git] / src / java / org / mxchange / pizzaapplication / model / customer / PizzaAdminCustomerSessionBean.java
index 30543e5c3d59bea13075ecd322f574da29a1ee98..70ebcb307d68348e57793aa8237326086e012bc8 100644 (file)
@@ -85,6 +85,9 @@ public class PizzaAdminCustomerSessionBean extends BasePizzaDatabaseBean impleme
                Contact contact = customer.getCustomerContact();
                Contact updatedContact = this.contactBean.lookupContact(contact);
 
+               // Debug message
+               this.getLoggerBeanLocal().logDebug(MessageFormat.format("addCustomer: contact={0},updatedContact={1}", contact, updatedContact));
+
                // Is a customer found?
                if (updatedContact instanceof Contact) {
                        // Set all entries
@@ -100,7 +103,15 @@ public class PizzaAdminCustomerSessionBean extends BasePizzaDatabaseBean impleme
 
                // Set created timestamp(s)
                customer.setCustomerCreated(new GregorianCalendar());
-               this.setAllContactPhoneEntriesCreated(contact);
+
+               // No conrtact was found?
+               if (null == updatedContact) {
+                       // Set created in contact, too
+                       contact.setContactCreated(new GregorianCalendar());
+
+                       // Set all "created" timestamps
+                       this.setAllContactPhoneEntriesCreated(contact);
+               }
 
                // Persist the customer
                this.getEntityManager().persist(customer);