Class QueryInterpreter


  • public class QueryInterpreter
    extends Object
    Interprets midPoint queries by translating them to hibernate (HQL) ones.

    There are two parts: - filter translation, - paging translation.

    As for filter translation, we traverse the filter depth-first, creating an isomorphic structure of Restrictions. While creating them, we continually build a set of entity references that are necessary to evaluate the query; these references are in the form of cartesian join of entities from which each one can have a set of entities connected to it via left outer join. An example:

    from RUser u left join u.assignments a with ... left join u.organization o, RRole r left join r.assignments a2 with ...

    This structure is maintained in InterpretationContext, namely in the HibernateQuery being prepared. (In order to produce HQL, we use ad-hoc "hibernate query model" in hqm package, rooted in HibernateQuery class.)

    Paging translation is done after filters are translated. It may add some entity references as well, if they are not already present.

    Author:
    lazyman, mederly