Answers for "public class PetDAO { public List<Pet> findNamedPetsBySpecies"

0

public class PetDAO { public List<Pet> findNamedPetsBySpecies

public List<Pet> findNamedPetsBySpecies(Session session, String species) {
        List<Pet> results = new ArrayList<Pet>();
        String sql = "Select p from " + Pet.class.getName() + " p "//
               + " Where p.species = :species and name != null";
       Query<Pet> query = session.createQuery(sql);
       query.setParameter("species", species);
       results = query.getResultList();
        return results;
    }
Posted by: Guest on March-24-2021

Code answers related to "public class PetDAO { public List<Pet> findNamedPetsBySpecies"

Browse Popular Code Answers by Language