@Override
    @SuppressWarnings("unchecked")
    public List<Visit> findByPetId(Integer petId) {
        Query query = this.em.createQuery("SELECT v FROM Visit v where v.pet.id= :id");
        query.setParameter("id", petId);
        return query.getResultList();
    }
JPA implementation of the ClinicService interface using EntityManager.
<p/>
<p>The mappings are defined in "orm.xml" located in the META-INF directory.

@author Mike Keith
@author Rod Johnson
@author Sam Brannen
@author Michael Isvy
@since 22.4.2006
src/main/java/org/springframework/samples/petclinic/repository/jpa/JpaVisitRepositoryImpl.java