Hibernate version: 3.1.2
I'm hoping someone will be able to explain an aspect of the way Hibernate works that has been causing me considerable difficulty. I'll try to be as quick and specific as possible and would be happy to just be directed to wherever I should be reading.
I have a Hibernate entity in a web application. I set various properties on an instance of this entity and save it. As part of saving the object, Hibernate seems to call all of the object's setter methods again, to re-set the properties, even though the new values being passed to the setters are the same as the existing property values. On one level, this seems redundant. On another level, I'd like one of the setters to have a side-effect so that it would matter when and where it was called. The stack trace when this re-setting occurs is as given below. The object that initiates it is an instance of DefaultSaveOrUpdateEventListener. Can anyone enlighten me as to why this happens and perhaps even how I can influence it?
Thanks in advance,
John.
PojoEntityTuplizer.setPropertyValues(Object, Object[]) line: 184
SingleTableEntityPersister(AbstractEntityPersister).setPropertyValues(Object, Object[], EntityMode) line: 3232
DefaultSaveOrUpdateEventListener(AbstractSaveEventListener).performSaveOrReplicate(Object, EntityKey, EntityPersister, boolean, Object, EventSource) line: 253
DefaultSaveOrUpdateEventListener(AbstractSaveEventListener).performSave(Object, Serializable, EntityPersister, boolean, Object, EventSource) line: 167
DefaultSaveOrUpdateEventListener(AbstractSaveEventListener).saveWithGeneratedId(Object, String, Object, EventSource) line: 114
DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(SaveOrUpdateEvent) line: 186
DefaultSaveOrUpdateEventListener.entityIsTransient(SaveOrUpdateEvent) line: 175
DefaultSaveOrUpdateEventListener.performSaveOrUpdate(SaveOrUpdateEvent) line: 98
DefaultSaveOrUpdateEventListener.onSaveOrUpdate(SaveOrUpdateEvent) line: 70
|