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

src/org/mxchange/addressbook/database/BaseAddressbookDatabaseBean.java

index 7ef7547e1d0f9840fc2ff9fbe0f0000027a2a4ba..9f92bad74269cb7a6b0584cc6d6f55cd43ce314d 100644 (file)
@@ -135,7 +135,7 @@ public abstract class BaseAddressbookDatabaseBean extends BaseDatabaseBean {
                this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N
 
                // Init query instance
-               DialableMobileNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
+               DialableMobileNumber foundNumber = this.getEntityManager().getReference(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
 
                // Debug message
                this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N
@@ -183,7 +183,7 @@ public abstract class BaseAddressbookDatabaseBean extends BaseDatabaseBean {
                this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N
 
                // Init query instance
-               DialableLandLineNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
+               DialableLandLineNumber foundNumber = this.getEntityManager().getReference(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
 
                // Debug message
                this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N
@@ -229,7 +229,7 @@ public abstract class BaseAddressbookDatabaseBean extends BaseDatabaseBean {
                this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: fetchedNumber.phoneId={0}", fetchedNumber.getPhoneId())); //NOI18N
 
                // Init query instance
-               DialableFaxNumber foundNumber = this.getEntityManager().find(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
+               DialableFaxNumber foundNumber = this.getEntityManager().getReference(fetchedNumber.getClass(), fetchedNumber.getPhoneId());
 
                // Debug message
                this.getLoggerBeanLocal().logDebug(MessageFormat.format("getDetached: foundNumber={0}", foundNumber)); //NOI18N
@@ -322,7 +322,7 @@ public abstract class BaseAddressbookDatabaseBean extends BaseDatabaseBean {
                contact.setContactUpdated(new GregorianCalendar());
 
                // Get contact from it and find it
-               Contact foundContact = this.getEntityManager().find(contact.getClass(), contact.getContactId());
+               Contact foundContact = this.getEntityManager().getReference(contact.getClass(), contact.getContactId());
 
                // Should be found
                assert (foundContact instanceof Contact) : MessageFormat.format("Contact with id {0} not found, but should be.", contact.getContactId()); //NOI18N
@@ -375,7 +375,7 @@ public abstract class BaseAddressbookDatabaseBean extends BaseDatabaseBean {
                        this.getLoggerBeanLocal().logDebug(MessageFormat.format("updateUserPersonalData: cellphone.phoneId={0} is being updated ...", cellphone.getPhoneId())); //NOI18N
 
                        // Then find it, too
-                       DialableMobileNumber foundMobile = this.getEntityManager().find(cellphone.getClass(), cellphone.getPhoneId());
+                       DialableMobileNumber foundMobile = this.getEntityManager().getReference(cellphone.getClass(), cellphone.getPhoneId());
 
                        // Should be there
                        assert (foundMobile instanceof DialableMobileNumber) : MessageFormat.format("Mobile number with id {0} not found but should be.", foundMobile.getPhoneId()); //NOI18N
@@ -399,7 +399,7 @@ public abstract class BaseAddressbookDatabaseBean extends BaseDatabaseBean {
                        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
@@ -423,7 +423,7 @@ public abstract class BaseAddressbookDatabaseBean extends BaseDatabaseBean {
                        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