]> git.mxchange.org Git - pizzaservice-ejb.git/commitdiff
type-hints to the JPA can also be interfaces, good! :-)
authorRoland Häder <roland@mxchange.org>
Tue, 26 Apr 2016 07:40:54 +0000 (09:40 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 26 Apr 2016 20:27:20 +0000 (22:27 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
nbproject/build-impl.xml
src/java/org/mxchange/jcontacts/contact/PizzaContactSessionBean.java
src/java/org/mxchange/jcountry/data/PizzaCountrySingletonBean.java
src/java/org/mxchange/jphone/phonenumbers/phone/PizzaPhoneSessionBean.java
src/java/org/mxchange/jusercore/model/user/PizzaUserSessionBean.java
src/java/org/mxchange/pizzaapplication/model/customer/PizzaAdminCustomerSessionBean.java
src/java/org/mxchange/pizzaapplication/model/customer/PizzaCustomerSessionBean.java

index 6ab33adb919ab0e209bb40dc711f5f0af18e70f8..eb490301b08b260b15386805272d7139cdc1dfb6 100644 (file)
@@ -25,8 +25,8 @@ is divided into following sections:
         </condition>
     </fail>
     <target depends="dist,javadoc" description="Build whole project." name="default"/>
-    <!-- 
-                INITIALIZATION SECTION 
+    <!--
+                INITIALIZATION SECTION
             -->
     <target name="-pre-init">
         <!-- Empty placeholder for easier customization. -->
@@ -749,9 +749,9 @@ or ant -Dj2ee.platform.classpath=&lt;server_classpath&gt; (where no properties f
     <target name="-init-taskdefs">
         <fail unless="libs.CopyLibs.classpath">
 The libs.CopyLibs.classpath property is not set up.
-This property must point to 
+This property must point to
 org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part
-of NetBeans IDE installation and is usually located at 
+of NetBeans IDE installation and is usually located at
 &lt;netbeans_installation&gt;/java&lt;version&gt;/ant/extra folder.
 Either open the project in the IDE and make sure CopyLibs library
 exists or setup the property manually. For example like this:
index ee42d89ae90678a06061f01ceb7bdf5974aab839..5ff7fc823a676553896521fc9ff6b64421f7fa94 100644 (file)
@@ -22,7 +22,7 @@ import javax.ejb.Stateless;
 import javax.persistence.NoResultException;
 import javax.persistence.Query;
 import org.mxchange.jcontacts.exceptions.ContactNotFoundException;
-import org.mxchange.pizzaaplication.database.BasePizzaDatabaseBean;
+import org.mxchange.pizzaaplication.database.BasePizzaDatabaseBean;;
 
 /**
  * A contact EJB
@@ -58,7 +58,7 @@ public class PizzaContactSessionBean extends BasePizzaDatabaseBean implements Co
                }
 
                // Get query instance
-               Query query = this.getEntityManager().createNamedQuery("SearchContactById", UserContact.class); //NOI18N
+               Query query = this.getEntityManager().createNamedQuery("SearchContactById", Contact.class); //NOI18N
 
                // Set parameter
                query.setParameter("contactId", contactId); //NOI18N
index 87d67df738ade8882568c2cfec4f6c3a58c19a7e..feb834039ac8926851e978e6ffc764cb866da89b 100644 (file)
@@ -16,6 +16,7 @@
  */
 package org.mxchange.jcountry.data;
 
+import de.chotime.jratecalc.database.BasePizzaDatabaseBean;
 import java.text.MessageFormat;
 import java.util.GregorianCalendar;
 import java.util.List;
@@ -110,7 +111,7 @@ public class PizzaCountrySingletonBean extends BasePizzaDatabaseBean implements
                boolean isAdded = false;
 
                // Get query instance
-               Query query = this.getEntityManager().createNamedQuery("SearchCountryByCodeI18nKey", CountryData.class); //NOI18N
+               Query query = this.getEntityManager().createNamedQuery("SearchCountryByCodeI18nKey", Country.class); //NOI18N
 
                // Assign all parameters
                query.setParameter("code", country.getCountryCode()); //NOI18N
index 3f4cb504e96b1713745aa7862f4fd2ae5b4d51e7..a7c0e1ccc825aee2458b06cf6ba8ff0d95acc08b 100644 (file)
@@ -21,7 +21,6 @@ import javax.ejb.Stateless;
 import javax.persistence.NoResultException;
 import javax.persistence.Query;
 import org.mxchange.jphone.exceptions.PhoneEntityNotFoundException;
-import org.mxchange.jphone.phonenumbers.cellphone.CellphoneNumber;
 import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
 import org.mxchange.pizzaaplication.database.BasePizzaDatabaseBean;
 
@@ -59,7 +58,7 @@ public class PizzaPhoneSessionBean extends BasePizzaDatabaseBean implements Phon
                }
 
                // Now find it
-               Query query = this.getEntityManager().createNamedQuery("SearchCellphoneId", CellphoneNumber.class); //NOI18N
+               Query query = this.getEntityManager().createNamedQuery("SearchCellphoneId", DialableCellphoneNumber.class); //NOI18N
 
                // Set parameter
                query.setParameter("cellphoneId", cellphoneId); //NOI18N
index f3130b4ee25e84ea8c3177e25d3e153028a2448c..7cfa90f98bfcca00491b11710fdde58b624e2f3d 100644 (file)
@@ -203,7 +203,7 @@ public class PizzaUserSessionBean extends BasePizzaDatabaseBean implements UserS
                }
 
                // Try to locate it
-               Query query = this.getEntityManager().createNamedQuery("SearchUserName", LoginUser.class); //NOI18N
+               Query query = this.getEntityManager().createNamedQuery("SearchUserName", User.class); //NOI18N
 
                // Set parameter
                query.setParameter("param", user.getUserName()); //NOI18N
@@ -242,7 +242,7 @@ public class PizzaUserSessionBean extends BasePizzaDatabaseBean implements UserS
                }
 
                // Create query instance
-               Query query = this.getEntityManager().createNamedQuery("SearchUserId", LoginUser.class); //NOI18N
+               Query query = this.getEntityManager().createNamedQuery("SearchUserId", User.class); //NOI18N
 
                // Set user id
                query.setParameter("id", userId); //NOI18N
@@ -301,7 +301,7 @@ public class PizzaUserSessionBean extends BasePizzaDatabaseBean implements UserS
                }
 
                // Generate query
-               Query query = this.getEntityManager().createNamedQuery("SearchUserId", LoginUser.class); //NOI18N
+               Query query = this.getEntityManager().createNamedQuery("SearchUserId", User.class); //NOI18N
 
                // Set parameter
                query.setParameter("id", user.getUserId()); //NOI18N
@@ -348,7 +348,7 @@ public class PizzaUserSessionBean extends BasePizzaDatabaseBean implements UserS
                }
 
                // Generate query
-               Query query = this.getEntityManager().createNamedQuery("SearchUserId", LoginUser.class); //NOI18N
+               Query query = this.getEntityManager().createNamedQuery("SearchUserId", User.class); //NOI18N
 
                // Set parameter
                query.setParameter("id", userId); //NOI18N
@@ -395,7 +395,7 @@ public class PizzaUserSessionBean extends BasePizzaDatabaseBean implements UserS
                }
 
                // Generate query
-               Query query = this.getEntityManager().createNamedQuery("SearchUserName", LoginUser.class); //NOI18N
+               Query query = this.getEntityManager().createNamedQuery("SearchUserName", User.class); //NOI18N
 
                // Set parameter
                query.setParameter("param", userName); //NOI18N
@@ -433,7 +433,7 @@ public class PizzaUserSessionBean extends BasePizzaDatabaseBean implements UserS
                }
 
                // Generate query
-               Query query = this.getEntityManager().createNamedQuery("SearchEmailAddress", LoginUser.class); //NOI18N
+               Query query = this.getEntityManager().createNamedQuery("SearchEmailAddress", User.class); //NOI18N
 
                // Set parameter
                query.setParameter("param", user.getUserContact().getContactEmailAddress()); //NOI18N
@@ -474,7 +474,7 @@ public class PizzaUserSessionBean extends BasePizzaDatabaseBean implements UserS
                }
 
                // Generate query
-               Query query = this.getEntityManager().createNamedQuery("SearchUserName", LoginUser.class); //NOI18N
+               Query query = this.getEntityManager().createNamedQuery("SearchUserName", User.class); //NOI18N
 
                // Set parameter
                query.setParameter("param", user.getUserName()); //NOI18N
index b338715403c6b4b6971fbeef21435caa360f3455..6a9b845b80f1c7b9af024cfe17ab227f2ecc84f1 100644 (file)
@@ -19,6 +19,7 @@ package org.mxchange.pizzaapplication.model.customer;
 import java.text.MessageFormat;
 import java.util.List;
 import javax.ejb.Stateless;
+import javax.persistence.NoResultException;
 import javax.persistence.Query;
 import org.mxchange.jcustomercore.model.customer.Customer;
 import org.mxchange.jcustomercore.utils.CustomerUtils;
@@ -59,7 +60,7 @@ public class PizzaAdminCustomerSessionBean extends BasePizzaDatabaseBean impleme
        @Override
        public String createCustomerNumber () {
                // Init named query
-               Query query = this.getEntityManager().createNamedQuery("SearchCustomerByNumber", RateCalcCustomer.class);
+               Query query = this.getEntityManager().createNamedQuery("SearchCustomerByNumber", Customer.class);
 
                // Default is not found
                String customerNumber = null;
@@ -67,7 +68,19 @@ public class PizzaAdminCustomerSessionBean extends BasePizzaDatabaseBean impleme
                // Search until a free number was found
                while (null == customerNumber) {
                        // Create new number
-                       String cn = CustomerUtils.generateCustomerNumber(RateCalcAdminCustomerSessionBeanRemote.CUSTOMER_NUMBER_LENGTH);
+                       String cn = CustomerUtils.generateCustomerNumber(PizzaAdminCustomerSessionBeanRemote.CUSTOMER_NUMBER_LENGTH, PizzaAdminCustomerSessionBeanRemote.CUSTOMER_NUMBER_BLOCK_SIZE, PizzaAdminCustomerSessionBeanRemote.CUSTOMER_NUMBER_SEPARATOR);
+
+                       // Set the generated number as param
+                       query.setParameter("customerNumber", cn);
+
+                       // Try to find it
+                       try {
+                               // Get a single result
+                               Customer customer = (Customer) query.getSingleResult();
+                       } catch (final NoResultException ex) {
+                               // Not found, okay
+                               customerNumber = cn;
+                       }
                }
        }
 
index b8732b1e6d6cd0bcf338c167fc07a45ec9cf6261..cbf716e2b037eabcdfa4085a2ab722c6c18dca76 100644 (file)
@@ -45,7 +45,7 @@ public class PizzaCustomerSessionBean extends BasePizzaDatabaseBean implements P
 
        @Override
        public Customer registerCustomer (final Customer customer) throws CustomerAlreadyRegisteredException {
-               throw new UnsupportedOperationException("Registration by guests is not supported with RateCalc application."); //NOI18N
+               throw new UnsupportedOperationException("Registration by guests is not supported with Pizza application."); //NOI18N
        }
 
 }