I'm facing some problems to organize my mapping methods in my code. I'm doing the mapping logic in the controller layer but some entities needs diferents dtos to each operation (insert, update e delete).
I created a generic controller with 2 types: the original entity and the dto type. But this stucked it in this case with multiple dto representations. I'm not sure if create 3 generic types is a good way to handle this.
Another problem is that my controller layer is getting bigger with many mapping methods. Even using ModelMapper as automapper, some cases I prefer do it by myself than create complex converter classes.
How can I organize my dto mapping code and don't overload my controller with lots of mapping methods?
P.S: My project is a rest api with jax-rs, cdi and jpa
Aucun commentaire:
Enregistrer un commentaire