From: Roland Häder Date: Mon, 25 Apr 2016 16:14:11 +0000 (+0200) Subject: Started with createCustomerNumber(), unfinished X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f87d88efbabf74586d551b71b00c0562209b5a0e;p=pizzaservice-ejb.git Started with createCustomerNumber(), unfinished Signed-off-by: Roland Häder --- diff --git a/src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java b/src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java index 8d0b967..23630da 100644 --- a/src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java +++ b/src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java @@ -22,6 +22,7 @@ import javax.ejb.Stateless; import javax.persistence.Query; import org.mxchange.jcustomercore.model.customer.Customer; import org.mxchange.pizzaaplication.database.BasePizzaDatabaseBean; +import org.mxchange.jcustomercore.utils.CustomerUtils; /** * A stateless administrative customer session bean (EJB) @@ -55,4 +56,19 @@ public class PizzaAdminCustomerSessionBean extends BasePizzaDatabaseBean impleme return customers; } + @Override + public String createCustomerNumber () { + // Init named query + Query query = this.getEntityManager().createNamedQuery("SearchCustomerByNumber", RateCalcCustomer.class); + + // Default is not found + String customerNumber = null; + + // Search until a free number was found + while (null == customerNumber) { + // Create new number + String cn = CustomerUtils.generateCustomerNumber(RateCalcAdminCustomerSessionBeanRemote.CUSTOMER_NUMBER_LENGTH); + } + } + }