Stef
Stef

Reputation: 2683

Javers throws exception when property is null

I have this issue where, if a property of a composite is null (note it's not the ID), Javers throws an exception:

JaversException PROPERTY_ACCESS_ERROR: error getting value from property 'Method User getPersonEntity; //declared in: HibernateProxy_$$_javassist_356' on target object of type 'HibernateProxy_$$_javassist_356', cause: java.lang.reflect.InvocationTargetException: null

or

JaversException PROPERTY_ACCESS_ERROR: error getting value from property 'Method List getAddress; //declared in: ... **Object property of the audited object**, cause: java.lang.reflect.InvocationTargetException: null

So, imagine the following structure:

User contains Person, which contains Address - all objects with their own properties.

If I commit a User object, if either Person or Address has a null property, Javers fails with the above error.

How does Javers handle null properties? Can it be configured to just not log a null property or to log it as null? I can't see a reason why it should throw an exception when a property is null?! There doesn't seem to be any documentation about how null properties are handled.

Upvotes: 0

Views: 700

Answers (1)

Bartek Walacik
Bartek Walacik

Reputation: 3496

JaVers deals with nulls without any problems, but your getter didn't return null but thrown exception. Seems your object is a Hibernate dynamic proxy and cant'b be initialized.

Upvotes: 1

Related Questions