C
C
Chvalov2018-11-21 19:18:32
MySQL
Chvalov, 2018-11-21 19:18:32

What is the purpose of mapstruct?

I didn’t find anything in RuNet on mapstruct in which cases should it be used?
As I understand it, issuing an entity (Entity) in REST json is a bad tone, but why, then, in all courses, mapping is not affected or misunderstood?
If possible, give examples of using mapstruct from real projects

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Igor Kalashnikov, 2015-11-21
@hrvasiliy

user_id | transport_type | transport_id
transport_type - will indicate in which table to look for transport_id, you can call transport_table and write the table name right away, but this is not kosher)

S
sim3x, 2015-11-21
@sim3x

ПользовательТранспорта:
   имя
   транспорт пользователя = ManyToMany(ТипТранспорта)
...

ТипТранспорта
    название
...

N
nozzy, 2015-11-21
@nozzy

Can be done on 2 tables.
table user_transport:
user_id | transport_id
table transport:
id | params | value
1 | transport_type | bus
1 | name_param1 | value1
1 | name_param2 | value2
and so on
2 | transport_type | metro
2 | name_param1 | value1
2 | name_param2 | value2
and so on

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question