private String merge() { charmsUser.setEmail(email); charmsUser.setThemeId(themeId); charmsUser.setTimezoneId(timezoneId); charmsUser.setLocaleId(localeId); // merge the user to the DB, the user is outjected to session charmsUser = (CharmsUser) hibernateSession.merge(charmsUser); hibernateSession.flush(); // set the session parameters from the user values localeSelector.selectLocaleId(charmsUser.getLocaleId()); themeSelector.selectThemeId(charmsUser.getThemeId()); timezoneSelector.selectTimeZoneId(charmsUser.getTimezoneId()); // ((Session)entityManager.getDelegate()).flush(); return "saved"; }