スプリングセキュリティが実装されたスプリングMVC3.0アプリケーションがあります。現在ログインしているユーザーのパスワードを変更するための小さなポップアップを作成しています。フォームを次のアクションに投稿するまでは、すべて順調です。
@RequestMapping(value = "principalchangepassword" , method = RequestMethod.POST)
public @ResponseBody String principalchangepassword(Model uiModel, HttpServletRequest httpServletRequest){
Principal principal = (Principal) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
StandardStringDigester digester = new StandardStringDigester();
digester.setAlgorithm("SHA-256"); // optionally set the algorithm
digester.setStringOutputType("hexadecimal");
digester.setSaltSizeBytes(0);
digester.setIterations(1);
String digest = digester.digest(httpServletRequest.getParameter("password1"));
principal.setPassword(digest.toLowerCase());
principal.merge();
return "Password Updated successfully";
}
現在のプリンシパルのパスワードを更新するためにajax呼び出しを実行すると、次の例外メッセージが表示されます。
org.hibernate.TransientObjectException: object references an unsaved transient instance – save the transient instance before flushing
私は何を間違っているのですか?