hibernate QueryException: impossible de résoudre propriété au printemps petclinic exemple d'application

J'ai le texte suivant JPA méthode:

@SuppressWarnings("unchecked")
public Collection<Owner> findByPetType(Integer typeID) {
    Query query = this.em.createQuery("SELECT DISTINCT owner FROM Owner owner left join fetch owner.pets as pet WHERE pet.type_id LIKE :typeID");
    query.setParameter("typeID", typeID + "%");
    return query.getResultList();
}  

Il est en train de lancer le message d'erreur suivant:

org.hibernate.QueryException: could not resolve property: type_id of:  
org.springframework.samples.petclinic.model.Pet [SELECT DISTINCT owner FROM  
org.springframework.samples.petclinic.model.Owner owner left join fetch owner.pets  
as pet WHERE pet.type_id LIKE :typeID];  
nested exception is java.lang.IllegalArgumentException:  
org.hibernate.QueryException: could not resolve property: type_id of:  
org.springframework.samples.petclinic.model.Pet [SELECT DISTINCT owner FROM      
org.springframework.samples.petclinic.model.Owner owner left join fetch owner.pets  
as pet WHERE pet.type_id LIKE :typeID]  

C'est à partir du Printemps petclinic exemple d'application, de sorte que tous les code est sur ce lien, y compris la base de données de définition. Je suis l'aide de la hsqldb et jpa, la findByPetType() la méthode ci-dessus est quelque chose que j'ai écrit, ce qui n'est pas dans l'exemple d'application.

Quelqu'un peut me montrer comment corriger le code de sorte qu'il ne produit pas ce message d'erreur?

EDIT:

J'ai suivi Alex conseils et changé animal de compagnie.type_id pour animaux de compagnie.type. Maintenant, il me donne le message d'erreur suivant (la valeur de typeID est mis à 1):

Parameter value [1%] did not match expected type  
[org.springframework.samples.petclinic.model.PetType]; nested exception is  
java.lang.IllegalArgumentException: Parameter value [1%] did not match expected type  
[org.springframework.samples.petclinic.model.PetType]  

DEUXIÈME EDIT:

J'ai fait Sergi Almar la suggestion, et maintenant il est en train de jeter l'erreur suivante:

Parameter value [1%] did not match expected type [java.lang.Integer]; nested exception   
is java.lang.IllegalArgumentException: Parameter value [1%] did not match expected type   
[java.lang.Integer]  

J'ai vérifié, et le code appelant initie typeID comme "Entier typeID = 1;" Donc, je ne suis pas sûr de savoir pourquoi il n'est pas de voir un nombre entier ici.

OriginalL'auteur CodeMed | 2013-09-05