How to use onetomany in Java
•
Java
Write at the beginning
Onetomany declared using jhipster has no mapping relationship with many's dto in one's dto. In order to use many's dto in one's dto, use the following three steps to solve this problem.
step
1. The one to many relationship written for yourself at "Mark 1" in onedto. The variable name here cannot be consistent with the corresponding variable name in entity one, otherwise the compilation fails.
2. Add manymapper to the uses attribute at "Mark 2" in onemapper.
2. Use @ mapping annotation at "mark 3" in onemapper to declare the mapping relationship between entity and dto.
Entity
DTO
Mapper
The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码