I have a class as following need to add people to it, but I just have the id of people, do I need to retrieve all the objects before associating them to myList ?
class People{
private long id;
private String name;
....
}
class myList{
private long id;
@OneToMany
private List<People> people;
...
}
class myModel{
....
{
List long selectedPeople <<< has ids such as 8 9 7 6 45 6
myList mylist = new MyList();
mylist.setPeople(selectedPeople);
session.save(mylist);
...
}
List<Long>you can't set something expectingList<People>