public List findPostByName(Long [] Poste,String Nom)抛出ServiceException { 列表resultat = null;
try {
resultat = this.entityManager.createNativeQuery
(
"SELECT "
+ "id, "
+ " non, "
+ " prenom, "
+ " direction, "
+ " emplacement "
+ "FROM intervention "
+ "WHERE Post= :Post"
+ "AND Nom= :Nom"
)
.setParameter("Post", Arrays.asList(Post))
.setParameter("Nom", Nom)
.getResultList();
log.info("=============GETRESULTAT========>>>"+resultat);
}catch(Exception e){
System.err.println(e.getMessage());
}
return resultat ;
}
答案 0 :(得分:0)
必须有一些异常,您需要记录堆栈跟踪然后解决问题。 Query.getResultList()永远不会给你空列表。您可以通过触发以下查询然后添加参数来调试问题:
"SELECT "
+ "id, "
+ " non, "
+ " prenom, "
+ " direction, "
+ " emplacement "
+ "FROM intervention "