public static UserModel detach(UserModel user) { if (user != null) { Hibernate.initialize(user); Hibernate.initialize(user.getRoles()); Hibernate.initialize(user.getProvider()); } return user; }
public void createAction(UserModel user, String eMail) { VerifyMailActionData data = new VerifyMailActionData(); ActionResult create = actionService.createAction(this, data); if (create.wasSuccessfull()) { SimpleMailMessage message = new SimpleMailMessage(template); message.setTo(user.getEmail()); String body = texte.text("action.verify.mail.body"); body = body.replace("{link}", ActionResult.ACTION_URL); message.setText(body.toString()); mailer.sendMessage(create.getContentReplacer(), message); } }