]> git.mxchange.org Git - addressbook-mailer-ejb.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Fri, 19 Aug 2016 15:49:20 +0000 (17:49 +0200)
committerRoland Häder <roland@mxchange.org>
Fri, 9 Jun 2017 20:00:42 +0000 (22:00 +0200)
- change find() to getReference() as this causes no additional SELECT on database backend

src/java/org/mxchange/jphone/phonenumbers/phone/AddressbookAdminPhoneSessionBean.java
src/java/org/mxchange/jusercore/model/user/AddressbookAdminUserSessionBean.java
src/java/org/mxchange/jusercore/model/user/AddressbookUserSessionBean.java

index 413a24108546fb29306914eb77a0a591297907a5..945d7342b59bebb06f25a9fa633c5a5ff0858c9c 100644 (file)
@@ -209,7 +209,7 @@ public class AddressbookAdminPhoneSessionBean extends BaseAddressbookDatabaseBea
                mobileNumber.setPhoneEntryUpdated(new GregorianCalendar());
 
                // Get contact from it and find it
-               DialableMobileNumber foundNumber = this.getEntityManager().find(mobileNumber.getClass(), mobileNumber.getPhoneId());
+               DialableMobileNumber foundNumber = this.getEntityManager().getReference(mobileNumber.getClass(), mobileNumber.getPhoneId());
 
                // Should be found
                assert (foundNumber instanceof DialableMobileNumber) : MessageFormat.format("Cell phone number with id {0} not found, but should be.", mobileNumber.getPhoneId()); //NOI18N
index 642c3fc5d3f536c6b430d134a7dff5f39ba1e841..54067277e0d9b08a60c47067bc7de276e592c575 100644 (file)
@@ -184,7 +184,7 @@ public class AddressbookAdminUserSessionBean extends BaseAddressbookDatabaseBean
                }
 
                // Try to find the contact
-               Contact foundContact = this.getEntityManager().find(user.getUserContact().getClass(), user.getUserContact().getContactId());
+               Contact foundContact = this.getEntityManager().getReference(user.getUserContact().getClass(), user.getUserContact().getContactId());
 
                // Set detached object in rexcruiter instance
                user.setUserContact(foundContact);
index f9e21d423194fcc0ea37e9ecef616f291c6c9f78..6221f378281b9ecd656fcf1676c710dbfe64fefb 100644 (file)
@@ -573,7 +573,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                user.setUserContact(null);
 
                // Find the instance
-               User foundUser = this.getEntityManager().find(user.getClass(), user.getUserId());
+               User foundUser = this.getEntityManager().getReference(user.getClass(), user.getUserId());
 
                // Should be found!
                assert (foundUser instanceof User) : MessageFormat.format("User with id {0} not found, but should be.", user.getUserId()); //NOI18N
@@ -672,7 +672,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                }
 
                // Find the instance
-               User foundUser = this.getEntityManager().find(user.getClass(), user.getUserId());
+               User foundUser = this.getEntityManager().getReference(user.getClass(), user.getUserId());
 
                // Should be found!
                assert (foundUser instanceof User) : MessageFormat.format("User with id {0} not found, but should be.", user.getUserId()); //NOI18N
@@ -691,7 +691,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                detachedUser.getUserContact().setContactUpdated(new GregorianCalendar());
 
                // Get contact from it and find it
-               Contact foundContact = this.getEntityManager().find(user.getUserContact().getClass(), user.getUserContact().getContactId());
+               Contact foundContact = this.getEntityManager().getReference(user.getUserContact().getClass(), user.getUserContact().getContactId());
 
                // Should be found
                assert (foundContact instanceof Contact) : MessageFormat.format("Contact with id {0} not found, but should be.", user.getUserContact().getContactId()); //NOI18N
@@ -720,7 +720,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                        this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: mobile.phoneId={0} is being updated ...", mobileNumber.getPhoneId())); //NOI18N
 
                        // Then find it, too
-                       DialableMobileNumber foundMobile = this.getEntityManager().find(mobileNumber.getClass(), mobileNumber.getPhoneId());
+                       DialableMobileNumber foundMobile = this.getEntityManager().getReference(mobileNumber.getClass(), mobileNumber.getPhoneId());
 
                        // Should be there
                        assert (foundMobile instanceof DialableMobileNumber) : MessageFormat.format("Mobile number with id {0} not found but should be.", foundMobile.getPhoneId()); //NOI18N
@@ -747,7 +747,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                        this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: fax.phoneId={0} is being updated ...", fax.getPhoneId())); //NOI18N
 
                        // Then find it, too
-                       DialableFaxNumber foundFax = this.getEntityManager().find(fax.getClass(), fax.getPhoneId());
+                       DialableFaxNumber foundFax = this.getEntityManager().getReference(fax.getClass(), fax.getPhoneId());
 
                        // Should be there
                        assert (foundFax instanceof DialableFaxNumber) : MessageFormat.format("Fax number with id {0} not found but should be.", foundFax.getPhoneId()); //NOI18N
@@ -774,7 +774,7 @@ public class AddressbookUserSessionBean extends BaseAddressbookDatabaseBean impl
                        this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: landLine.phoneId={0} is being updated ...", landLine.getPhoneId())); //NOI18N
 
                        // Then find it, too
-                       DialableLandLineNumber foundLandLine = this.getEntityManager().find(landLine.getClass(), landLine.getPhoneId());
+                       DialableLandLineNumber foundLandLine = this.getEntityManager().getReference(landLine.getClass(), landLine.getPhoneId());
 
                        // Should be there
                        assert (foundLandLine instanceof DialableLandLineNumber) : MessageFormat.format("Land line number with id {0} not found but should be.", foundLandLine.getPhoneId()); //NOI18N