Hi,
I've got a POJO I'm persisting using using Hibernate 3.05. If I do the following
Code:
pojo = session.get(MyPojo.class, 3);
assertNull(pojo.getBirthday());
pojo.setBirthday(today);
session.flush();
then nothing gets flushed. The debug logs shows zero dirty objects.
I've traced this through to DefaultFlushEntityEventListener.dirtyCheck() which calls BasicEntityPersister.findDirty(), which calls TypeFactory.findDirty() which , for my property calls DateType.isDirty(), which is inherited from AbstractType.
The final code looks like this...
Code:
return x==y || ( x!=null && y!=null && x.equals(y) );
So if either the original or the new value is null, then the object is not considered dirty! But it is dirty, because I've just changed a property!
To me this seems like a bad default. Can anyone defend it. (I'm new to hibernate, btw)
Is there any way to solve this other than implementing my own interceptor?
Thanks for reading.
David