0

For my 'School Management Project' I am using Spring Boot REST, hibernate Data JPA and MySQL as Database.

I have one Student class which has 5 attributes.

I want to implement a feature which will allow Admin to add few more attributes to the Student class from UI, and the attribute will be of fixed data types (String, Boolean, Integer, float, double).

this is because we can not predict all the Student properties beforehand. So user will see a page were he can add the Attribute name its Data type and the class on which he wants to add the property.

Next time any user creates new entry of Student, he will see new attributes added for student by Admin as well as default attributes from POJO.

how hibernate will create DTO which will have attributes from POJO Student class and also from custom attributes from DB which we had added later? Also how Student DTO will be saved with all the POJO and custom attributes?

after looking on I came to know that this approach is called EAV 'Entity Attribute Value'

but did not found any examples on the internet

UPDATE 1: found this Video of how to design DB for EAV model, I find it feasible and may move in this direction. Not sure about JAVA implementation of this approach. EAV Zero to EAV Hero

here are some Links I found but I am still not getting the point

How to store data with dynamic number of attributes in a database

EAV is it really bad in all scenarios

  • Does this answer your question? [JPA 2 Custom Entity Fields](https://stackoverflow.com/questions/22786493/jpa-2-custom-entity-fields) – Evgeny Bovykin Nov 08 '21 at 09:24
  • I got this Question as a reference but still having hard time to grasp. [JPA 2 custom entity fields](https://stackoverflow.com/questions/22786493/jpa-2-custom-entity-fields) – akash jadhav Nov 09 '21 at 05:23
  • found this Video of how to design DB for EAV model, i find it feasible and may move in this direction. not sure about JAVA implementation of this approach. [EAV Zero to EAV Hero](https://www.youtube.com/watch?v=WneHTRZVbec&t=20s) – akash jadhav Nov 09 '21 at 07:27

0 Answers0