org.springframework.dao.InvalidDataAccessApiUsageException:The given object has a null identifi的解决方案

异常信息:

org.springframework.dao.InvalidDataAccessApiUsageException: The given object has a null identifier: com.blog.entity.PersonalizedSettings; nested exception is org.hibernate.TransientObjectException: The given object has a null identifier: com.blog.entity.PersonalizedSettings


发生原因:抛这个异常是因为,当你在更新数据时,从JSP页面往Action传值没有传递ID值。

解决方案:把ID值放在隐藏域传递过去就OK了

 <input type="hidden" name="personalizedSettings.id" value="<s:property value='personalizedSettings.id'/>"/> 

版权声明:本文为博主原创文章,未经博主允许不得转载。

原文地址:https://www.cnblogs.com/yunns/p/4867904.html