object references an unsaved transient instance - save the transient instance before flushing(异常总结)
来源:互联网 发布:hadoop java mapreduce 编辑:程序博客网 时间:2024/05/21 17:43
org.springframework.dao.InvalidDataAccessApiUsageException: object references an unsaved transient instance - save the transient instance before flushing
字面意思:异常说的是你引用了一个没有保存的对象,也就是说引用了一个数据库还没有的记录进行别的操作。
但有时候也会很郁闷 明明没有使用瞬时对象啊…… (那是不可能的没使用就不会报错了)
有时候你可能在不经意间使用了瞬时对象 比如 我犯的一个错
在学习Spring自动装配后决定好好啊 可以少写好多配置代码,然后就用了。后果是没学精之前千万不要乱用……
<beans default-autowire="byName">
<bean id="users" class="com.jzbr.entity.Users"></bean>
<bean id="usersAction" class="com.jzbr.action.UsersAction"></bean>
上面三行代码是没有问题的
问题是 Action中使用了
Users nowUsers;
get set 省略;
因为是自动装配使用的 byName , 而 Id值与属性名不一致,虽然启动服务的时候不会报错但是一旦你使用了 nowUsers这个对象 就会触发上面说的异常,因为nowUsers没有注入成功
- object references an unsaved transient instance - save the transient instance before flushing(异常总结)
- object references an unsaved transient instance - save the transient instance before flushing(异常总结)
- object references an unsaved transient instance - save the transient instance before flushing异常
- 异常object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing .
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing
- object references an unsaved transient instance - save the transient instance before flushing:
- xHTML和CSS容易犯的一些错误
- 第13 周-项目2
- hibernate中HQL
- java设计模式之创建型模式-FactoryMethod ( 工厂方法 )
- 写博客的原因
- object references an unsaved transient instance - save the transient instance before flushing(异常总结)
- form中 button不能用的问题
- 做一个有规划的人
- ubuntu服务器VPN配置
- PL SQL Developer中文乱码问题解决
- Ubuntu 安装XAMPP集成环境软件包 与 运行WordPress 的简单方法
- extjs 4 tab的相关处理
- 木有学历混进google的四步
- 设计模式---->简单工厂模式