I’m trying to store this type of data
[
1: [
{
"id":"1"
},
{
"id":"2"
},
],
2: [
{
"id":"2"
},
{
"id":"3"
},
{
"id":"4"
}
]
]
within this class
public class TripItinerary {
@Id
private Long id;
@OneToMany(cascade = CascadeType.ALL, orphanRemoval = true)
@JoinColumn(name = "trip_itinerary_id")
private List<List<Place>> itinerary;
where Place is an entity stored in a ‘place’ table.
Currently, I am getting a ‘One To Many’ attribute value type should not be ‘List’ error.
I’ve tried creating another entity with List<Place>, but I do not have any use case with individual List<Place> objects, so I feel like it is a waste of resources. Is there a better way to handle nested List<List<Objects>> in Spring Boot?