错误描述全称:
javax.persistence.TransactionRequiredException: No EntityManager with actual transaction available for current thread - cannot reliably process 'persist' call
原因:
没有在事务内进行表更新插入或者删除操作。
解决办法:
@RequestMapping("save")
@Transactional
public void save(HttpServletRequest request , HttpServletResponse response , User user){
}
在方法上头加入注解
@Transactional