]> git.mxchange.org Git - pizzaservice-ejb.git/commitdiff
Some fixes:
authorRoland Häder <roland@mxchange.org>
Tue, 26 Apr 2016 12:38:14 +0000 (14:38 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 27 Apr 2016 19:06:59 +0000 (21:06 +0200)
- only set "created" timestamps when new contact
- logger message added

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);