Package com.axelor.db

Class Query.JoinHelper

  • Enclosing class:
    Query<T extends Model>

    protected static class Query.JoinHelper
    extends Object
    JoinHelper class is used to auto generate LEFT JOIN for association expressions.

    For example:

        Query<Contact> q = Contact.all().filter("self.title.code = ?1 OR self.age > ?2", "mr", 20);
     
    Results in:
     SELECT self FROM Contact self LEFT JOIN self.title _title WHERE _title.code = ?1 OR self.age > ?2
     
    So that all the records are matched even if title field is null.
    • Constructor Detail

      • JoinHelper

        public JoinHelper​(Class<?> beanClass)
    • Method Detail

      • parse

        public String parse​(String filter,
                            boolean translate)
        Parse the given filter string and return transformed filter expression.

        Automatically calculate LEFT JOIN for association path expressions and the path expressions are replaced with the join variables.

        Parameters:
        filter - the filter expression
        translate - whether to generate translation join
        Returns:
        the transformed filter expression
      • toString

        public String toString​(boolean fetch)