org.apache.cayenne.map

## Class SQLTemplateDescriptor

- java.lang.Object
- - org.apache.cayenne.map.QueryDescriptor
  - - org.apache.cayenne.map.SQLTemplateDescriptor

- All Implemented Interfaces:
    Serializable, ConfigurationNode, XMLSerializable

      public class SQLTemplateDescriptor
      extends QueryDescriptor

  Since:
    4.0
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Map<String,String>` | `adapterSql`
    `protected String` | `sql`

    - ### Fields inherited from class org.apache.cayenne.map.QueryDescriptor

      `dataMap, EJBQL_QUERY, name, PROCEDURE_QUERY, properties, root, SELECT_QUERY, SQL_TEMPLATE, type`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SQLTemplateDescriptor()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `SQLTemplate` | `buildQuery()` Assembles Cayenne query instance of appropriate type from this descriptor.
    `void` | `encodeAsXML(XMLEncoder encoder)` Prints itself as XML to the provided XMLEncoder.
    `Map<String,String>` | `getAdapterSql()` Returns map of db adapter specific SQL statements.
    `String` | `getSql()` Returns default SQL statement for this query.
    `void` | `setAdapterSql(Map<String,String> adapterSql)` Sets a map db adapter specific SQL statements for this query.
    `void` | `setSql(String sql)` Sets default SQL statement for this query.

    - ### Methods inherited from class org.apache.cayenne.map.QueryDescriptor

      `acceptVisitor, descriptor, ejbqlQueryDescriptor, getDataMap, getName, getProperties, getProperty, getRoot, getType, procedureQueryDescriptor, selectQueryDescriptor, setDataMap, setName, setProperties, setProperty, setRoot, setType, sqlTemplateDescriptor`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### sql

          protected String sql

    - #### adapterSql

          protected Map<String,String> adapterSql

  - ### Constructor Detail

    - #### SQLTemplateDescriptor

          public SQLTemplateDescriptor()

  - ### Method Detail

    - #### getSql

          public String getSql()

      Returns default SQL statement for this query.

    - #### setSql

          public void setSql(String sql)

      Sets default SQL statement for this query.

    - #### getAdapterSql

          public Map<String,String> getAdapterSql()

      Returns map of db adapter specific SQL statements.

    - #### setAdapterSql

          public void setAdapterSql(Map<String,String> adapterSql)

      Sets a map db adapter specific SQL statements for this query.

    - #### buildQuery

          public SQLTemplate buildQuery()

      Description copied from class: `QueryDescriptor`
      Assembles Cayenne query instance of appropriate type from this descriptor.
      Overrides:
        `buildQuery` in class `QueryDescriptor`

    - #### encodeAsXML

          public void encodeAsXML(XMLEncoder encoder)

      Description copied from interface: `XMLSerializable`
      Prints itself as XML to the provided XMLEncoder.
      Specified by:
        `encodeAsXML` in interface `XMLSerializable`
      Overrides:
        `encodeAsXML` in class `QueryDescriptor`

Copyright © 2001–2023 Apache Cayenne. All rights reserved.