]> git.mxchange.org Git - pizzaservice-ejb.git/commitdiff
Started with createCustomerNumber(), unfinished
authorRoland Häder <roland@mxchange.org>
Mon, 25 Apr 2016 16:14:11 +0000 (18:14 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 26 Apr 2016 17:13:23 +0000 (19:13 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java

index 8d0b967fc11ba7d59fe9fe24f4523e3185406be9..23630da30bde417baefb422ec48f35224421db55 100644 (file)
@@ -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);
+               }
+       }
+
 }