Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.map
Class QueryBuilder

    java.lang.Object
      org.apache.cayenne.map.QueryBuilder

    public abstract class QueryBuilder

extends Object

A builder that constructs Cayenne queries from abstract configuration information defined in cayenne-data-map*.dtd. This abstract builder supports values declared in the DTD, allowing subclasses to define their own Query creation logic.

Since:
  1.1
Author:
  Andrus Adamchik

Field Summary
`protected Map` | `adapterSql`
`static String` | `DATA_MAP_ROOT`
`protected DataMap` | `dataMap`
`static String` | `DB_ENTITY_ROOT`
`static String` | `JAVA_CLASS_ROOT`
`protected String` | `name`
`static String` | `OBJ_ENTITY_ROOT`
`protected List` | `orderings`
`protected List` | `prefetches`
`static String` | `PROCEDURE_ROOT`
`protected Map` | `properties`
`protected Expression` | `qualifier`
`protected List` | `resultColumns`
`protected String` | `resultEntity`
`protected String` | `rootName`
`protected String` | `rootType`
`protected String` | `sql`

Constructor Summary
`QueryBuilder()`

Method Summary
`void` | `addOrdering(String path, String descending, String ignoreCase)`
`void` | `addPrefetch(String path)`
`void` | `addProperty(String name, String value)`
`void` | `addSql(String sql, String adapterClass)` Adds raw sql.
`abstract Query` | `getQuery()` Builds a Query object based on internal configuration information.
`protected Object` | `getRoot()` Determines query root based on configuration info, falls back to a DataMap root if the data is invalid.
`void` | `setName(String name)`
`void` | `setQualifier(String qualifier)`
`void` | `setResultEntity(String resultEntity)`
`void` | `setRoot(DataMap dataMap, String rootType, String rootName)` Sets the information pertaining to the root of the query.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### OBJ_ENTITY_ROOT

    public static final String OBJ_ENTITY_ROOT

See Also:
  Constant Field Values

### DB_ENTITY_ROOT

    public static final String DB_ENTITY_ROOT

See Also:
  Constant Field Values

### PROCEDURE_ROOT

    public static final String PROCEDURE_ROOT

See Also:
  Constant Field Values

### DATA_MAP_ROOT

    public static final String DATA_MAP_ROOT

See Also:
  Constant Field Values

### JAVA_CLASS_ROOT

    public static final String JAVA_CLASS_ROOT

See Also:
  Constant Field Values

### name

    protected String name

### properties

    protected Map properties

### resultColumns

    protected List resultColumns

### sql

    protected String sql

### adapterSql

    protected Map adapterSql

### qualifier

    protected Expression qualifier

### orderings

    protected List orderings

### prefetches

    protected List prefetches

### dataMap

    protected DataMap dataMap

### rootType

    protected String rootType

### rootName

    protected String rootName

### resultEntity

    protected String resultEntity

Constructor Detail

### QueryBuilder

    public QueryBuilder()

Method Detail

### getQuery

    public abstract Query getQuery()

  Builds a Query object based on internal configuration information.

### setName

    public void setName(String name)

### getRoot

    protected Object getRoot()

  Determines query root based on configuration info, falls back to a DataMap root if the data is invalid.

  Throws:
    `CayenneRuntimeException` - if a valid root can't be established.

### setResultEntity

    public void setResultEntity(String resultEntity)

### setRoot

    public void setRoot(DataMap dataMap,
                        String rootType,
                        String rootName)

  Sets the information pertaining to the root of the query.

### addSql

    public void addSql(String sql,
                       String adapterClass)

  Adds raw sql. If adapterClass parameter is not null, sets the SQL string to be adapter-specific. Otherwise it is used as a default SQL string.

### setQualifier

    public void setQualifier(String qualifier)

### addProperty

    public void addProperty(String name,
                            String value)

### addOrdering

    public void addOrdering(String path,
                            String descending,
                            String ignoreCase)

### addPrefetch

    public void addPrefetch(String path)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2007 Apache Cayenne. All Rights Reserved.