开发者

Customizing detection change

开发者 https://www.devze.com 2022-12-25 02:41 出处:网络
I can now if a session contain any changes which must be synchronized with the database with session.isDirty()

I can now if a session contain any changes which must be synchronized with the database with session.isDirty()

But i have a simple field (modification date) that i would like to be ignore by it. Example: object Person( name,age,datemodification).

if i just modify the datemodification field i would like that session.isDirty() or othermethod like this to return false so at the end no sql update will occur.

Thanks in advance. 开发者_开发百科Regards


If you were using Hibernate Annotations you could annotate datemodification with @Transient which would mean any changes to that field would not be persisted.


I think that you would need to use an Interceptor and override the onFlushDirty() method. This looks like a forum that discusses the same question.

0

精彩评论

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