steve wrote:
An uninitialized proxy, by definition, cannot be modified in terms of its persistent state. Why would you need to audit it?
If uninitialized proxied object is updated without first referencing the current value, the previous value that Hibernate saved off and provides to the Interceptor as the previous value will be uninitialized.
Consider:
Code:
<hibernate-mapping>
<class name="Foo" table="Foo">
...
<many-to-one name="status" class="Status" cacade="all"/>
...
</class>
<hibernate-mapping>
<hibernate-mapping>
<class name="Status" table="Status" lazy="true">
...
</class>
</hibernate-mapping>
Then somewhere in application code:
Code:
...
Foo f = session.find(...);
// note f.status is unintialized at this point --
// and is not referenced in this code
f.setStatus(new Status(...));
f.save();
Now in the interceptor, if I try reference the previous (uninitialized) value of status in this foo object, it will cause it to be initialized which, in an interceptor callback, is not allowed.