- only set "created" timestamps when new contact
- logger message added
Contact contact = customer.getCustomerContact();
Contact updatedContact = this.contactBean.lookupContact(contact);
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
// Is a customer found?
if (updatedContact instanceof Contact) {
// Set all entries
// Set created timestamp(s)
customer.setCustomerCreated(new GregorianCalendar());
// 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);
// Persist the customer
this.getEntityManager().persist(customer);