Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.objectstyle.cayenne.access.trans
Class SqlSelectTranslator  view SqlSelectTranslator download SqlSelectTranslator.java

java.lang.Object
  extended byorg.objectstyle.cayenne.access.QueryTranslator
      extended byorg.objectstyle.cayenne.access.trans.QueryAssembler
          extended byorg.objectstyle.cayenne.access.trans.SqlSelectTranslator
All Implemented Interfaces:
SelectQueryTranslator

public class SqlSelectTranslator
extends QueryAssembler
implements SelectQueryTranslator

Class works as a translator of raw SELECT queries to JDBC statements.


Field Summary
private static org.apache.log4j.Logger logObj
           
 
Fields inherited from class org.objectstyle.cayenne.access.trans.QueryAssembler
attributes, values
 
Fields inherited from class org.objectstyle.cayenne.access.QueryTranslator
adapter, con, engine, query
 
Constructor Summary
SqlSelectTranslator()
           
 
Method Summary
 java.lang.String aliasForTable(org.objectstyle.cayenne.map.DbEntity dbEnt)
          Returns a name that can be used as column alias.
static void appendResultTypesFromMetadata(java.sql.ResultSet rs, org.objectstyle.cayenne.access.util.ResultDescriptor desc)
          Initializes the types of columns in ResultDescriptor from the ResultSet metadata.
static void appendSnapshotLabelsFromMetadata(java.sql.ResultSet rs, org.objectstyle.cayenne.access.util.ResultDescriptor descriptor)
          Initializes the names of columns in ResultDescriptor from the ResultSet metadata.
 java.lang.String createSqlString()
          Translates query into sql string.
 void dbRelationshipAdded(org.objectstyle.cayenne.map.DbRelationship dbRel)
          Processes a join being added.
private  org.objectstyle.cayenne.query.SqlSelectQuery getRawQuery()
           
 org.objectstyle.cayenne.access.util.ResultDescriptor getResultDescriptor(java.sql.ResultSet rs)
          Returns a descriptor that contains information needed for the ResultSet processing.
 boolean supportsTableAliases()
          Returns true if table aliases are supported.
 
Methods inherited from class org.objectstyle.cayenne.access.trans.QueryAssembler
addToParamList, aliasForTable, createStatement, initStatement
 
Methods inherited from class org.objectstyle.cayenne.access.QueryTranslator
getAdapter, getCon, getEngine, getQuery, getRootDbEntity, getRootEntity, setAdapter, setCon, setEngine, setQuery
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logObj

private static org.apache.log4j.Logger logObj
Constructor Detail

SqlSelectTranslator

public SqlSelectTranslator()
Method Detail

appendResultTypesFromMetadata

public static void appendResultTypesFromMetadata(java.sql.ResultSet rs,
                                                 org.objectstyle.cayenne.access.util.ResultDescriptor desc)
Initializes the types of columns in ResultDescriptor from the ResultSet metadata.


appendSnapshotLabelsFromMetadata

public static void appendSnapshotLabelsFromMetadata(java.sql.ResultSet rs,
                                                    org.objectstyle.cayenne.access.util.ResultDescriptor descriptor)
Initializes the names of columns in ResultDescriptor from the ResultSet metadata.


aliasForTable

public java.lang.String aliasForTable(org.objectstyle.cayenne.map.DbEntity dbEnt)
Description copied from class: QueryAssembler
Returns a name that can be used as column alias. This can be one of the following:
  • an alias for this table, if it uses aliases
  • a fully qualified table name, if not.
CayenneRuntimeException is thrown if a table alias can not be created.

Specified by:
aliasForTable in class QueryAssembler

createSqlString

public java.lang.String createSqlString()
                                 throws java.lang.Exception
Description copied from class: QueryAssembler
Translates query into sql string. This is a workhorse method of QueryAssembler. It is called internally from createStatement. Usually there is no need to invoke it explicitly.

Specified by:
createSqlString in class QueryAssembler

dbRelationshipAdded

public void dbRelationshipAdded(org.objectstyle.cayenne.map.DbRelationship dbRel)
Description copied from class: QueryAssembler
Processes a join being added.

Specified by:
dbRelationshipAdded in class QueryAssembler

getRawQuery

private org.objectstyle.cayenne.query.SqlSelectQuery getRawQuery()

getResultDescriptor

public org.objectstyle.cayenne.access.util.ResultDescriptor getResultDescriptor(java.sql.ResultSet rs)
Description copied from interface: SelectQueryTranslator
Returns a descriptor that contains information needed for the ResultSet processing.

Specified by:
getResultDescriptor in interface SelectQueryTranslator

supportsTableAliases

public boolean supportsTableAliases()
Description copied from class: QueryAssembler
Returns true if table aliases are supported. Default implementation returns false.

Overrides:
supportsTableAliases in class QueryAssembler