保存数据报错:
org.hibernate.TransientPropertyValueException: object references an unsaved transient instance - save the transient instance before flushing : zz.ibs.domain.ShowMenu.parent -> zz.ibs.domain.ShowMenu; nested exception is java.lang.IllegalStateException: org.hibernate.TransientPropertyValueException: object references an unsaved transient instance - save the transient instance before flushing :
这是瞬时对象(临时对象)引起的保存错误,只需要重新写方法,不使用关联的瞬时数据即可。若是更改方法后还是报这个错,那么就去检查js层的代码,将提交的表单数据转为JSON对象即可。以$.post提交为例:
var param = $("#ffff").toJSON();
$.post("/menu/save",param,function(data){
if(data.result){
//关闭当前窗口
$("#win").window("close");
$.messager.alert('信息',data.msg,'info');
//添加成功后刷新列表
$('#dg').datagrid('load',{});
}else{
//弹出错误消息
$.messager.alert('错误',data.msg,'error');
}
},"json");