modelmapper / modelmapper-module-java8

ModelMapper Module for Java8
Apache License 2.0
14 stars 15 forks source link

Different result when ran on linux jenkins node #19

Open blindahl opened 3 years ago

blindahl commented 3 years ago

We have a pretty complex class structure and try to convert from database entity classes to POJO data transfer objects (DTO) back and forth. We use ModelMapper and switched to using Strict matching a while ago.

We're using spock as testing framework and when running on Windows we never get any problem but when we run in our Jenkins CI environment, under linux every now and then mapping confuses objects and mix up instances within the class structure. If we have class structure like this for instance:

class EntityA {
   class EntityB;
   class EntityC;
}

class DtoA {
   class DtoB;
   class DtoC;
}

Do we have to add mappings with type maps for EntityA where EntityB maps to DtoB, EntityC to DtoC and the opposite direction as well, when using strict matching?

If it most of the times work but every now and then fail to convet class structure, could the lack of complete mappings really be the reason? When it fails it looks like all type maps are just fine. I've added debug output so I see all mappings ModelMapper have registered which makes it confusing. Modelmapper.validate() never fails either. I understand that it's not much detailed information but does anyone have any direction what might cause our irregular behavior it would be very appreciated.

Kind regards Björn

blindahl commented 3 years ago

Actually we narrowed it down to ModelMapper being the blame for our issues but forgot about this ticket. I can see if I can find a minimal viable project that give us the error to post in the issue tracker. We unfortunately switched it out for another similar solution which hasn't shown the same issue. Hopefully I'll find the time to post the code.