I'm currently trying to perform audit logging of changed properties using an Interceptor
in Hibernate 2.x.
Problem is, the entity I'm trying to save is a detached object so the previousState
array in onFlushDirty
method of Interceptor
always return null. They say that this can be simply solved by calling merge
but that method is not available in Hibernate 2.x. Any tips on how I can workaround the problem?
Also, would you have any ideas on how easy or how hard it is to implement something like merge
in a开发者_StackOverflow中文版n application running Hibernate 2.x?
Thanks!
In Hibernate 2.x, have you tried using saveOrUpdate(Object)
? This was the initial workaround provided by Hibernate until they added merge()
in Hibernate 3.
精彩评论