Javers default ignore instead of default include

前提是你 提交于 2019-12-24 01:18:06

问题


Is there a way to default ignore all fields except explicitly included in Javers? I'm trying to persist CGLib proxy objects, and it's picking up all of the CGLib fields along with the @Entity fields. So what I think would work better is ignore by default, and an annotation/config to say "use these fields".

I've also tried .withMappingStyle(MappingStyle.BEAN) which doesn't seem to make a difference.


回答1:


There is no such option but

  • you can ignore these CGLib proxy fields globally by type (if they have some meaningful types) using JaversBuilder.registerIgnoredClass(Class<?> ignoredClass)

  • I don't recommend committing CGLib proxy objects directly to JaVers. For Hibernate we have unproxy hook, see http://javers.org/documentation/domain-configuration/#hooks You can implememt unproxy hook for your ORM



来源:https://stackoverflow.com/questions/36317181/javers-default-ignore-instead-of-default-include

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!