的列表是有益的查詢後脫離大名單的實體,即使用默認模式像那些實體:JPA:拆下連接只讀實體
// Find all
for List<Device> devices = em.createNamedQuery("find.*.devices", Device.class).getResultList();
// Detach all
for (Device d : devices) {
em.detach(d);
}
我們能夠避免某些類型的負諸如錯誤地更新被視爲「只讀」(可以保證)的實體的數據庫或節省內存。
你的問題是什麼? –