Row Level role not working in composition

Hello!

I’m working with two entities: Customer and CustomerContact. I’ve created a constraint on an association value for the CustomerContact class:

    @JpqlRowLevelPolicy(entityClass = CustomerContact.class,
            where = "{E}.user.id = :current_user_id")
    void customerContact();

The Customer entity has an attribute called contacts which is a composition of type CustomerContact. The user attribute in my CustomerContact entity is an association to my extended user class, ExtUser. That being said, users with this row level role should be able to see all Customer entities, but only CustomerContact entities where the user field is set to themselves. This is not working. It does, however, filter CustomerContact entities correctly if viewing on a CustomerContact browse screen (which I only added to test).

Am I doing something wrong? I don’t see any documentation pertaining to composition attributes in regards to row level roles.

Let me know if you need me to create a test project for you.

Thank you!
Adam

Here’s an example project. I need to get this figured out as soon as possible. Thanks!

rowlevelcomp.zip (94.7 KB)

So, predicate policies?

1 Like

Yes. Quote from the docs:

The READ predicate is tested when the entity is loaded from the database for the root entity and (unlike JPQL policy) all nested collections down to the loaded object graph. If an entity can be loaded as a collection in another entity’s object graph, define both JPQL and predicate policies for it.

1 Like