Package com.axelor.db

Class Query.Selector

java.lang.Object
com.axelor.db.Query.Selector
Enclosing class:
Query<T extends Model>

public class Query.Selector extends Object
A helper class to select specific field values. The record is returned as a Map object with the given names as keys.
 List<Map> data = Contact.all().filter("self.age > ?", 20)
        .select("title.name", "fullName", "age").fetch(80, 0);
 
This results in following query:
 SELECT _title.name, self.fullName JOIN LEFT self.title AS _title WHERE self.age > ? LIMIT 80
 
The fetch(int, int) method returns a List of Map instead of the model object.
  • Method Details

    • values

      public List<List> values(int limit, int offset)
    • fetch

      public List<Map> fetch(int limit, int offset)
    • toString

      public String toString()
      Overrides:
      toString in class Object