未初始化的代理传递给persist()

时间:2011-06-24 17:44:40

标签: mysql hibernate jpa

1 个答案:

答案 0 :(得分:0)

由于您没有提供太多详细信息,因此很难确定发生了什么,但我猜您有代理但在尝试持久化对象之前从未到过数据库获取对象信息。来自Hibernate文档的相关内容:

If the class is mapped with a proxy, load() just returns an uninitialized proxy 
and does not actually hit the database until you invoke a method of the proxy.

http://docs.jboss.org/hibernate/core/3.3/reference/en/html/objectstate.html#objectstate-loading