A
A
Alexander Batula2019-10-11 14:18:16
PostgreSQL
Alexander Batula, 2019-10-11 14:18:16

How to store in the database a nested list of objects that do not have an id field?

Good afternoon, help with the solution of the problem, it is not possible to save a nested list of objects:

{
    "total": 1,
    "School": [
        {
            
            "id": "12",
            "nmb": "59",
            "name": "Имени Ивана Неизвестного"
            "Classes": [
                {
                    "name": "Математика",
                    "value": 12,
                },
                {
                    "name": "Физика",
                    "value": 21"
                },
                {
                   "name": "Химия",
                    "value": 22"
                }
}

Help how to make a more optimal solution where each class corresponded to the id of the school. Can this be done with Hibernate
Thanks in advance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Y
Yerlan Ibraev, 2019-10-11
@mad_nazgul

Well... Looks like for classes the natural key would be (id, name).
Where id are strings in School.
name is the name field in Classes
:-)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question