0
我有一個類如下需要添加人員,但我只有人的id,我需要檢索所有對象之前將它們關聯到myList?如何使用ID插入記錄列表?
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'你不能設置什麼期望'List ' –
nachokk
我需要檢索它們嗎? –