I have a class that currently has a few properties that are formed using formulas so that queries using the class can be sorted and pages according to the formula-built properties. What I've found out, though, is that I need to dynamically alter some of those formulas based on the user who is retrieving the objects.
To be more specific, I have a search form that returns a list of Policy objects, according to specific criteria. Each Policy object has some totals that are populated as properties with formulas so that the search form can allow a user to order by, and page by, the totals. Some of the subqueries within the total formulas, though, need to be filtered according to user security.
So, is there a way to pass in variables or otherwise change the formulas for the totals on a Policy object? Or is there another way I should set this up? I would put the totals queries in the java class, but then I couldn't sort or page using Hibernate's Criteria builders (as far as I know).
Thanks for any help,
|