开发者

Any tips on backporting merge() operation from Hibernate 3 to a custom Hibernate 2 application?

开发者 https://www.devze.com 2023-02-25 19:09 出处:网络
I\'m currently trying to perform audit logging of changed properties using an Interceptor in Hibernate 2.x.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消