steve wrote:
I *think* what you are asking for is the ability to bind a number of parameters to a given filter?
Code:
<class name="File" ...>
...
<filter name="pcf" condition="F_CHECK_ACCESS( READABLE_BY, OWNER, :userId )"/>
</class>
That's correct!
Now I realized my problem is slightly more complex.
Because in some situations, we want to have Access Control List (ACL) for the objects. I plan to use component collection to store ACL entries, like:
Code:
File {
Id = 123456
Title = "Guide for migrating to Hibernate"
ACL = [
{ "dude", "FULL_ACCESS" },
{ "programmers", "READ" }
]
}
The ACL component table, of course, looks like
Code:
create table FILE_ACL {
FILE_ID primary key ref FILE.ID
SUBJECT_ID
}
create unique index on (FILE_ID, SUBJECT_ID)
How do I effectively write the condition query?
You remind me now that I can use stored procedure. While it works, is it efficient enough? It does not seem to be able to take advantage of the index associated with the ACL table as the logic expression is hidden in a procedure. If the DB has to load every record and execute the procedure, that wouldn't be very performant. Am I right for the worry? Is there a way to express the filtering condition in declarative SQL expression for this more complex case?
Thanks
[/code]