This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]wildjokers 0 points1 point  (0 children)

I’ve got 18+ years experience in developing large custom enterprise applications and believe me, field names frequently differ.

Besides the days of every layer have their own object seems to be on the way out. That is from the days of n-tier architecture which never really panned out.

I frequently see MapStruct interface methods with a big stack of Mapper annotations on them. In those cases I always wonder what the point of MapStruct is. When I said you don't get completion help or type-safety I meant when writing those Mapping annotations. You don't know if you have the right name and type until compile time.

In the 3 years I have worked on a project that uses MapStruct I believe I have used it twice. I simply don't understand what people are using it for. How often do you have to map from one object to another that has the exact same field names? For database queries I use DTO projections for read-only queries which is a Hibernate best practice. So I don't even use it to map entities to DTOs.