I am trying to map openAPI model(Generated using Swagger codegen) and JPA Entity(Generated from database schema in Hibernate) in my java REST-API, so that I can save received model into database using JPA(hibernate) entity and use model to create response for fetching data from database.
I know I can create use model and entity separately and create a mechanism to convert from one to another. However, if there is any change in database or field in model I need to update both model and entity which is cumbersome.
Is there any way to define model/entity such that it can be used in both Swagger and hibernate JPA? and does not required to create both of them(which is redundant)