I am using EJB 3.0 entity beans and I have a specific requirement. I need to modify the named query at the run time like add some extra search criteria just before the actual execution. This needs to be done at the framework lavel so that developer do not care about it.
The requirement is simple. For each query being executed I want to put some restrictions depending upon the security constraints. For example in a accounting system, the logged in user has access to a set of departments, and this user should only see the Employees in that department. Now instead of putting department filter criteria in each query, I want to modify all the queries to add this criteria at the end(just before execution) depending upon the user access.