📜  公共类 PetDAO { 公共列表<Pet>findNamedPetsBySpecies - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:43.603000             🧑  作者: Mango

代码示例1
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;
    }