tx for the answer
I know about those annotation, but that would mean, that I have to put them on every entity that wants to write a history
or maybe it would work if I put it on a common superclass of all entities that want to keep a history
what my prefered method is:
- the entities that are interested in historical data must implement a special interface (e.g. Historical)
- there is a pre-insert and pre-update event listener, that will be called for all entities: inside this lisitener, I only need to check if the entitiy is an instance of my Historical inteface
I already got that working, but still have a problem, that is a bit like your's:
when I create my entity it's like that:
- pre-insert event listener is called
- Historical data is set on the entity (I checked this in the debugger)
- hibernate issues a sql-insert command: but without the data that has been set in teh pre-insert event listener!
- hibernate now issues an update command and sets the historical data that has been set in the pre-insert event listener
that sounds a lot like what you have encountered in your original post
I have already tried to find more information on this, but didn't find anything that would help me
the API doc of the PreInsertEventListener does not even mention what the expected returnvalue means!
http://www.hibernate.org/hib_docs/v3/api/org/hibernate/event/PreInsertEventListener.html