Question

I am facing a problem with Orika when trying to set null on the destination.

Right now my implementation works pretty well when the source has a value and the destination is null. It also works both source and destination have a value. The problem is when the value that i read from the source is null while on the destination is not.

I found that on version 1.4.0 the functions ClassMapBuilder.mapNulls(true|false) or ClassMapBuilder.mapNullsInReverse(true|false) can be used to solve this problem.

Unfortunately the above code does not seem to solve my problem, thus the destination field remains always unchanged although it should be set to null (according to the source).

Here are the different implementations that i tried.

 MapperFactory myfact = new DefaultMapperFactory.Builder().build();
 ClassMapBuilder<E, D> mapBuilder = factory.classMap(dest, source).mapNulls(true);


 MapperFactory myfact = new DefaultMapperFactory.Builder().mapNulls(true).build();
 ClassMapBuilder<E, D> mapBuilder = factory.classMap(dest, source);

Any suggestions?

Was it helpful?

Solution

This was finally a problem in the Orika software. The bug was fixed in release 1.4.2

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top