D
D
DarkByte20152017-07-26 17:27:39
Java
DarkByte2015, 2017-07-26 17:27:39

How to organize the correct mapping of objects in the spring?

Different languages ​​and frameworks use different approaches to data mapping, it is interesting to know which one is in spring? I mean that I have DBO models and view models that are sent to the client. Where do I place the mapping from one to the other? Some advocate thin models and moving the mapping to separate mapper classes. And for example, I like mapping directly in the model to write more ... How is it better?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Kosarev, 2017-07-26
@jaxtr

If within the framework of WebMVC, then DTO can also be transferred from the controller to views. In the opposite direction (that is, from the client when submitting the form), it is better to have separate classes that represent a set of form fields (it is more convenient in terms of validation).
If within the framework of REST, then there is such a beast as HATEOAS .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question