Package com.axelor.db
Class Query.JoinHelper
- java.lang.Object
-
- com.axelor.db.Query.JoinHelper
-
protected static class Query.JoinHelper extends Object
JoinHelper class is used to auto generateLEFT 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 iftitle
field is null.
-
-
Constructor Summary
Constructors Constructor Description JoinHelper(Class<?> beanClass)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
fixSelect(String query)
String
joinName(String name)
String
parse(String filter, boolean translate)
Parse the given filter string and return transformed filter expression.String
toString()
String
toString(boolean fetch)
-
-
-
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 expressiontranslate
- whether to generate translation join- Returns:
- the transformed filter expression
-
toString
public String toString(boolean fetch)
-
-