Save an object with a list using Spring CrudRepository

0

Hello, Is there any way to save an object with a list of objects (Set)? For example, I have the Artist and Album objects, Artist has a list of Albuns (Set). I would like when saving the Artist also save the list of Albums together, which would already be populated. Or, I would have to first save the Artist, get the Artist ID saved and only then call the albumRepository to save the Albuns list.

    
asked by anonymous 18.09.2018 / 04:28

1 answer

0

You can use this approach with hibernate:

link

mapping the relationships directly in the interface and setting the cascade.

    
21.09.2018 / 20:09