Is automatic dirty checking of directly accessed fields supposed to work in Hibernate? Even when Hibernate uses a proxy?
Example pseudocode:
Code:
cat = session.load(id)
cat.name = "john"
tx.commit
This code doesn't update the cat record for me. While stepping through in a debugger it seems that Hibernate create a proxy for cat, the name field of the cat proxy is indeed set, but commit doesn't even check for a dirty object because it thinks the session is empty (PersistenceContext.hasNonReadOnlyEntities= true).
If I replace load() with get() in the above code (which does NOT instantiate a proxy), then it works as expected, it updates the record.
Hibernate version: 3.0beta4
Mapping documents: Class with access="field"
[/code]