Hi,
most likely your JQPL statement is wrong. The name of the entity is not the class name, but the configured name of the @Entity
annotation. For the RoleAssignmentEntity, you can see the value looks like this:
@Table(name = "SEC_ROLE_ASSIGNMENT")
@Entity(name = "sec_RoleAssignmentEntity")
@JmixEntity
@SystemLevel
public class RoleAssignmentEntity implements Serializable {
Therefore your query needs to look like this:
List roleAssignmentList = dataManager.load(RoleAssignmentEntity.class)
.query(“select e from sec_RoleAssignmentEntity e where e.username=:userName”)
.parameter(“userName”, user.getUsername())
.list();
Besides that, you might also just use the APIs from the Framework, instead of using the underlying primitives. E.g. there are the two APIs RoleAssignmentRepository::getAssignmentsByUsername
and DatabaseRoleAssignmentProvider
which will probably serve your needs.
Cheers
Mario