From 92113b39cf94333ad6f963ad664faf5371b855e3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 26 Apr 2016 14:38:14 +0200 Subject: [PATCH] Some fixes: - only set "created" timestamps when new contact - logger message added --- .../customer/PizzaAdminCustomerSessionBean.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java b/src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java index 30543e5..70ebcb3 100644 --- a/src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java @@ -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); -- 2.39.5