Monday, March 24, 2014

Hibernate JPA Resolve Error Unable to resolve attribute [phone] against path

Removed
Working with JPA, I have an entity called Person which have reference on another entity called Phone.
In order to get the MobilePhone, I do :

root.join("phone", JoinType.LEFT).get("mobilePhone"),
OR
root.get("phone").get("mobilePhone"),

Doind this, I got an error :
Unable to resolve attribute [status] against path.

After some investigation, I have found that I have changed the name of my attribute in my code, from personPhone to phone, but the getter and setter still with the old name.
So to get my code working, I should use the same attribute name in  the getter also :

Person{

    Phone phone;
    ...
   Phone getPhone{
             return phone;
   }
}

1 comment :

Articles les plus consultés