From f87d88efbabf74586d551b71b00c0562209b5a0e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Mon, 25 Apr 2016 18:14:11 +0200 Subject: [PATCH] Started with createCustomerNumber(), unfinished MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Roland Häder --- .../customer/PizzaAdminCustomerSessionBean.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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); + } + } + } -- 2.39.5