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;
}
}
In order to get the MobilePhone, I do :
root.join("phone", JoinType.LEFT).get("mobilePhone"),
OR
root.get("phone").get("mobilePhone"),
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;
}
}
This comment has been removed by a blog administrator.
ReplyDelete