📅  最后修改于: 2022-03-11 14:56:43.603000             🧑  作者: Mango
public List findNamedPetsBySpecies(Session session, String species) {
List results = new ArrayList();
String sql = "Select p from " + Pet.class.getName() + " p "//
+ " Where p.species = :species and name != null";
Query query = session.createQuery(sql);
query.setParameter("species", species);
results = query.getResultList();
return results;
}