How to handle the dynmaic fields creation in ui and mapping it to the backend in the spring boot.
I have all the fields in the mysql and data storage in mongo.
How to map with pojo entity to save and retrive.
I have tried with the pojo and without pojo mpaiings using spring jpa.
2
Answers
"dynamic" fields ? Do you mean adding columns on the flight?
This is looks like LOV (anti-)pattern that could be mapped to an entity (id, owner_id, key, value) where all values will be store as string, the key will be your field name, id an IDENTITY, and owner_id the FK on the other entity owning the set of (key, value).
you UI consume a rest api that returns a list of fields to display. Up to you to choose how to store it :
In a relational database, you need to have a principal table and a table that store the fields and then you can retrieve it by a join.
In a mongodb, you can have a document, the fields will be a part of it as a json array and then you can retrive it by parsing the json.
Is that you want to do ? The how depends on what framework you use (I see Spring) (So Spring data works both with a mongodb and a mysql)