我在服务器日志中收到警告"使用集合提取指定的firstResult/maxResults;在内存中应用!" .然而一切正常.但我不想要这个警告.
public employee find(int id) {
return (employee) getEntityManager().createQuery(QUERY).setParameter("id", id).getSingleResult();
}
Run Code Online (Sandbox Code Playgroud)
QUERY = "from employee as emp left join fetch emp.salary left join fetch emp.department where emp.id = :id"
Run Code Online (Sandbox Code Playgroud)