Javers default ignore instead of default include

2019-07-08 19:17发布

问题:

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



标签: javers