Search code examples
javers

Javers default ignore instead of default include


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.


Solution

  • 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