rsql-jpa-specification
rsql-jpa-specification copied to clipboard
Throws an unknown property exception when i reduce the path by using the property map.
Hello,
I have a structure where a user has multiples roles, but in our database, the relationship between user and role is in a user_role_rel table because this table has additional fields like creationDate.
public class User {
private Date creationDate;
@OneToMany
private Set<UserRoleRel> userRoleRels;
}
public class UserRoleRel {
private Date creationDate;
@ManyToOne
private Role role;
}
public class Role {
private Date creationDate;
private int roleId;
}
If we filter users with a roleId, the classic path is "userRoleRels.role.roleId" and that's OK. But I would like to simplify the path with "roles.roleId" and hide the relationship table by adding a property mapping to User like this:
RSQLJPASupport.addMapping(User.class, "roles", "userRoleRels.role");
I received the exception:
Unknown property: roleId from entity User
I used version 5.x and the problem may be with the RSQLJPAPredicateConverter class in the findPropertyPath function . When the function is called by recursion, the root and attribute variables are set but not the classMetadata.
Thanks for your follow-up
Regards