我有一个类,如下需要添加人员,但我只有人员的 id,在将它们关联到 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);
...
}