I have a project where we are doing a restfull service with:
- Spring boot
- JPA
- JDBC
- WEB SPRING (MVC)
- Hibernate
Well currently I do not have much experience with hibernate in the onetomany relationship.
The detail is that for example, I have a parent class Recetas
, in the recipes I have a list of ingredients where I have an object of type Recetas
.
The onetomany of the recipe class maps it to the class of ingredients towards the recipe object, the detail is that I have an infinite loop.
Something like this:
RECETAS{
nombre:""
tiempo:""
etc.:""
ingredientes : [{nombre: "taltal","recetas":"{otro objeto de recetas}"}
]
}
And so the infinite cycle is followed inwards since each recipe object has an ingredient object and within the ingredients has a recipe object .. and so on. Any idea suggestion or recommendation? I have read all the sides that this is handled but I do not understand the concept very well.