-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
I think a common problem when using mapstruct for mapping entities to DTOs is that it might produce lazy loading of relations. So in case of different entity fetch graphs you would need different mapping methods that explicitly ignore the lazy loaded stuff and only map the eager loaded properties.
Luckily Hibernate allows to determine on its generated proxy entities if a property is eager or lazy loaded. So the idea is to extend mapstruct with a strategy to only map eager loaded properties by default.
I would be happy to contribute this, the question is where is the best place to extend this behaviour. To be honest the mapstruct architecture doesn't look very extendable for such use cases to provide custom mapping strategies.
Kind regards,
Michael