]> git.mxchange.org Git - jcontacts-business-core.git/commitdiff
Continued:
authorRoland Häder <roland@mxchange.org>
Wed, 1 Nov 2017 21:50:38 +0000 (22:50 +0100)
committerRoland Häder <roland@mxchange.org>
Wed, 1 Nov 2017 21:50:38 +0000 (22:50 +0100)
- removed Search<Entity>ById as this is considered as performance-reducing. The
  reason is, that the EJB will then be more "asked" for single entries only.
- added first named query AllHeadquarters

Signed-off-by: Roland Häder <roland@mxchange.org>
src/org/mxchange/jcontactsbusiness/model/basicdata/BusinessBasicData.java
src/org/mxchange/jcontactsbusiness/model/branchoffice/BusinessBranchOffice.java
src/org/mxchange/jcontactsbusiness/model/employee/BusinessEmployee.java
src/org/mxchange/jcontactsbusiness/model/headquarters/BusinessHeadquarters.java
src/org/mxchange/jcontactsbusiness/model/opening_time/BusinessOpeningTime.java

index d532bfc2e407f40e30b3284932cff6448e174989..88b5fca6f0c76ac3e59cc00a3f53f6cd27e1d2f0 100644 (file)
@@ -39,6 +39,7 @@ import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
 import org.mxchange.jcontactsbusiness.model.employee.BusinessEmployee;
 import org.mxchange.jcontactsbusiness.model.employee.Employable;
 import org.mxchange.jcontactsbusiness.model.headquarters.BusinessHeadquarters;
+import org.mxchange.jcontactsbusiness.model.headquarters.Headquarter;
 import org.mxchange.jcontactsbusiness.model.logo.BusinessLogo;
 import org.mxchange.jcontactsbusiness.model.logo.Logo;
 import org.mxchange.jphone.model.phonenumbers.fax.DialableFaxNumber;
@@ -47,7 +48,6 @@ import org.mxchange.jphone.model.phonenumbers.landline.DialableLandLineNumber;
 import org.mxchange.jphone.model.phonenumbers.landline.LandLineNumber;
 import org.mxchange.jusercore.model.user.LoginUser;
 import org.mxchange.jusercore.model.user.User;
-import org.mxchange.jcontactsbusiness.model.headquarters.Headquarter;
 
 /**
  * A POJO for business basic data
@@ -59,7 +59,6 @@ import org.mxchange.jcontactsbusiness.model.headquarters.Headquarter;
 @NamedQueries (
                {
                        @NamedQuery (name = "AllBusinessData", query = "SELECT b FROM company_basic_data AS b ORDER BY b.basicDataId"),
-                       @NamedQuery (name = "SearchBusinessDataById", query = "SELECT b FROM company_basic_data AS b WHERE b.basicDataId = :basicDataId")
                }
 )
 @SuppressWarnings ("PersistenceUnitPresent")
index 8c23a74e4d0e72e355b2e7215619ad9cb064485e..a24b326a8e4e9e21a222ca3237862665d15c3f2e 100644 (file)
@@ -62,7 +62,6 @@ import org.mxchange.jusercore.model.user.User;
 @NamedQueries (
                {
                        @NamedQuery (name = "AllBranchOffices", query = "SELECT bo FROM company_branch_offices AS bo ORDER BY bo.branchId ASC"),
-                       @NamedQuery (name = "SearchBranchOfficeById", query = "SELECT bo FROM company_branch_offices AS bo WHERE bo.branchId = :branchOfficeId")
                }
 )
 @SuppressWarnings ("PersistenceUnitPresent")
index 2e5c60621275d4a2e55cb221d477230e5212fd7d..d2407d7dfa45a9b15ee09cbe4d31f1046cce1af3 100644 (file)
@@ -35,20 +35,20 @@ import javax.persistence.TemporalType;
 import javax.persistence.Transient;
 import org.mxchange.jcontacts.model.contact.Contact;
 import org.mxchange.jcontacts.model.contact.UserContact;
+import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
 import org.mxchange.jcontactsbusiness.model.basicdata.BusinessBasicData;
 import org.mxchange.jcontactsbusiness.model.branchoffice.BranchOffice;
 import org.mxchange.jcontactsbusiness.model.branchoffice.BusinessBranchOffice;
 import org.mxchange.jcontactsbusiness.model.department.BusinessDepartment;
 import org.mxchange.jcontactsbusiness.model.department.Department;
 import org.mxchange.jcontactsbusiness.model.headquarters.BusinessHeadquarters;
+import org.mxchange.jcontactsbusiness.model.headquarters.Headquarter;
 import org.mxchange.jcontactsbusiness.model.jobposition.EmployeePosition;
 import org.mxchange.jcontactsbusiness.model.jobposition.JobPosition;
 import org.mxchange.jphone.model.phonenumbers.mobile.DialableMobileNumber;
 import org.mxchange.jphone.model.phonenumbers.mobile.MobileNumber;
 import org.mxchange.jusercore.model.user.LoginUser;
 import org.mxchange.jusercore.model.user.User;
-import org.mxchange.jcontactsbusiness.model.basicdata.BasicData;
-import org.mxchange.jcontactsbusiness.model.headquarters.Headquarter;
 
 /**
  * A POJO for company employees (including CEO)
@@ -60,7 +60,6 @@ import org.mxchange.jcontactsbusiness.model.headquarters.Headquarter;
 @NamedQueries (
                {
                        @NamedQuery (name = "AllEmployees", query = "SELECT e FROM company_employees AS e ORDER BY e.employeeId ASC"),
-                       @NamedQuery (name = "SearchEmployeeById", query = "SELECT e FROM company_employees AS e WHERE e.employeeId = :employeeId")
                }
 )
 @SuppressWarnings ("PersistenceUnitPresent")
index 892bf8d8cdaf9d94190d860a159ea401cc86c878..fc8dc392f2384baa14dc67b320d5ffc9d5cbf549 100644 (file)
@@ -30,6 +30,8 @@ import javax.persistence.Id;
 import javax.persistence.JoinColumn;
 import javax.persistence.JoinTable;
 import javax.persistence.ManyToMany;
+import javax.persistence.NamedQueries;
+import javax.persistence.NamedQuery;
 import javax.persistence.OneToOne;
 import javax.persistence.Table;
 import javax.persistence.Temporal;
@@ -55,6 +57,11 @@ import org.mxchange.jusercore.model.user.User;
  */
 @Entity (name = "company_headquarters")
 @Table (name = "company_headquarters")
+@NamedQueries (
+               {
+                       @NamedQuery (name = "AllHeadquarters", query = "SELECT hq FROM company_headquarters AS hq ORDER BY hq.headquartersId ASC")
+               }
+)
 @SuppressWarnings ("PersistenceUnitPresent")
 public class BusinessHeadquarters implements Headquarter {
 
@@ -96,7 +103,7 @@ public class BusinessHeadquarters implements Headquarter {
        /**
         * Email address of headquarters
         */
-       @Columnname = "headquarters_email_address")
+       @Column (name = "headquarters_email_address")
        private String headquartersEmailAddress;
 
        /**
@@ -181,37 +188,37 @@ public class BusinessHeadquarters implements Headquarter {
                // Validate parameters
                if (null == headquartersCity) {
                        // Throw NPE
-                       throw new NullPointerException("headquartersCity is null");
+                       throw new NullPointerException("headquartersCity is null"); //NOI18N
                } else if (headquartersCity.isEmpty()) {
                        // Throw IAE
-                       throw new IllegalArgumentException("headquartersCity is empty");
+                       throw new IllegalArgumentException("headquartersCity is empty"); //NOI18N
                } else if (null == headquartersCountry) {
                        // Throw NPE
-                       throw new NullPointerException("headquartersCountry is null");
+                       throw new NullPointerException("headquartersCountry is null"); //NOI18N
                } else if (headquartersCountry.getCountryId() == null) {
                        // Throw NPE again
-                       throw new NullPointerException("headquartersCountry.countryId is null");
+                       throw new NullPointerException("headquartersCountry.countryId is null"); //NOI18N
                } else if (headquartersCountry.getCountryId() < 1) {
                        // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("headquartersCountry.countryId={0} is not valid.", headquartersCountry.getCountryId()));
+                       throw new IllegalArgumentException(MessageFormat.format("headquartersCountry.countryId={0} is not valid.", headquartersCountry.getCountryId())); //NOI18N
                } else if (null == headquartersHouseNumber) {
                        // Throw NPE
-                       throw new NullPointerException("headquartersHouseNumber is null");
-               } else if (headquartersHouseNumber <1) {
+                       throw new NullPointerException("headquartersHouseNumber is null"); //NOI18N
+               } else if (headquartersHouseNumber < 1) {
                        // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("headquartersHouseNumber={0} is invalid.", headquartersHouseNumber));
+                       throw new IllegalArgumentException(MessageFormat.format("headquartersHouseNumber={0} is invalid.", headquartersHouseNumber)); //NOI18N
                } else if (null == headquartersStreet) {
                        // Throw NPE
-                       throw new NullPointerException("headquartersStreet is null");
+                       throw new NullPointerException("headquartersStreet is null"); //NOI18N
                } else if (headquartersStreet.isEmpty()) {
                        // Throw IAE
-                       throw new IllegalArgumentException("headquartersStreet is empty");
+                       throw new IllegalArgumentException("headquartersStreet is empty"); //NOI18N
                } else if (null == headquartersZipCode) {
                        // Throw NPE
-                       throw new NullPointerException("headquartersZipCode is null");
-               } else if (headquartersZipCode <1) {
+                       throw new NullPointerException("headquartersZipCode is null"); //NOI18N
+               } else if (headquartersZipCode < 1) {
                        // Throw IAE
-                       throw new IllegalArgumentException(MessageFormat.format("headquartersZipCode={0} is invalid.", headquartersZipCode));
+                       throw new IllegalArgumentException(MessageFormat.format("headquartersZipCode={0} is invalid.", headquartersZipCode)); //NOI18N
                }
 
                // Set all fields
index c794ea15480fe93c0ff71684c7461b145f7e30f1..f164a518dca5cdce42771c3982c6cbdbb2795212 100644 (file)
@@ -44,7 +44,6 @@ import org.mxchange.jcontactsbusiness.model.opening_time.dayofweek.DayOfTheWeek;
 @NamedQueries (
                {
                        @NamedQuery (name = "AllOpeningTimes", query = "SELECT ot FROM company_opening_times AS ot ORDER BY ot.openingId ASC"),
-                       @NamedQuery (name = "SearchOpeningTimesById", query = "SELECT ot FROM company_opening_times AS ot WHERE ot.openingId = :openingId")
                }
 )
 @SuppressWarnings ("PersistenceUnitPresent")