I posted a comment to the AuditInfo pattern page (
http://www.hibernate.org/48.html), transcribed below.
The problem is I implemented that pattern and got a different behavior to the stated there. When entering in the onFlushDirty event, I receive the 'entity' object filled with AuditInfo data, and when entering onSave event, in the line:
AuditInfo ai = ((Auditable) entity).getAuditInfo();
the outcome of getAuditInfo is null, failing in the next ai.setCreated line.
I think I left something to configure or define since Hibernate refused to process the mytable.hbm.xml due to the lack of setAuditInfo member (the interface correctly defined only the getter), so I must put the setter in the definition to get Hibernate happy (this may be the root cause of my issue)...
Have any of you dealt with that pattern, what am I missing to do?
Thank you very much,
Leandro