]> git.mxchange.org Git - jjobs-ejb.git/commitdiff
Please cherry-pick:
authorRoland Häder <roland@mxchange.org>
Wed, 31 Aug 2016 13:32:16 +0000 (15:32 +0200)
committerRoland Haeder <roland@mxchange.org>
Wed, 31 Aug 2016 19:56:50 +0000 (21:56 +0200)
- renamed updatedUser -> managedUser
- better set all data in EJB to avoid managedUser become detached (as the scope is not EJB anymore)

src/java/org/mxchange/jusercore/model/user/JobsUserSessionBean.java

index 9cb2a0ab012f5b66de5914994ffd515b06a985f5..094e9c83d960901201634dd53324bfa39a551c19 100644 (file)
@@ -642,12 +642,14 @@ public class JobsUserSessionBean extends BaseJobsDatabaseBean implements UserSes
                }
 
                // Call other method
-               User updatedUser = this.updateUserData(user);
+               User managedUser = this.updateUserData(user);
 
                // Create history entry
-               PasswordHistory entry = new UserPasswordHistory(user.getUserEncryptedPassword(), updatedUser);
+               PasswordHistory entry = new UserPasswordHistory();
 
-               // Set created timestamp
+               // Set all data here to avoid user instance become detached again
+               entry.setUserPasswordHistoryPasswordHash(managedUser.getUserEncryptedPassword());
+               entry.setUserPasswordHistoryUser(managedUser);
                entry.setUserPasswordHistoryCreated(new GregorianCalendar());
 
                // Persist it
@@ -661,7 +663,7 @@ public class JobsUserSessionBean extends BaseJobsDatabaseBean implements UserSes
 
                try {
                        // Create email address and set
-                       emailAddress = new InternetAddress(updatedUser.getUserContact().getContactEmailAddress());
+                       emailAddress = new InternetAddress(managedUser.getUserContact().getContactEmailAddress());
                } catch (final AddressException ex) {
                        // Throw again
                        throw new EJBException(ex);