SolarMetric Kodo JDO 2.4.3 generated on March 27 2003

com.solarmetric.kodo.impl.jdbc.sql
Class ObjectSelect

java.lang.Object
  |
  +--com.solarmetric.kodo.impl.jdbc.sql.SQLStatement
        |
        +--com.solarmetric.kodo.impl.jdbc.sql.Select
              |
              +--com.solarmetric.kodo.impl.jdbc.sql.ObjectSelect

public class ObjectSelect
extends Select

Extends the basic SQL select with Object-level mapping methods for joining across relations, etc.


Constructor Summary
ObjectSelect(DBDictionary dict, ClassResolver resolver)
           
ObjectSelect(ObjectSelect copy, ClassResolver resolver)
           
 
Method Summary
 SQLStatement and(SQLStatement same)
          AND the previous WHERE clause with the given one.
 void clear()
          Clear the WHERE clause and table list so that this statement can be reused.
 void clearWhere()
          Clear the WHERE clause.
 ObjectSelect endRelationTraversal()
          Reset the relation path.
 String getColumnAlias(Column col)
          Return the alias being used for the given column, given the current series of traversed relations.
 SQLBuffer getSQLBuffer()
          Return the SQLBuffer to be used for exeucting the statement;
 SQLBuffer getWhere()
          Return the WHERE portion of the SQL statement.
 ObjectSelect join(Column[] col1, Column[] col2)
          Join the given columns.
 ObjectSelect joinRelation(ClassMapping cm, Column[] col1, Column[] col2)
          Join the given columns, where the second column represents the traversal into a new relation.
 ObjectSelect joinRelation(Relation rel, Column[] col1, Column[] col2)
          Join the given columns, where the second column represents the traversal into a new relation.
 SQLStatement or(SQLStatement same)
          OR the previous WHERE clause with the given one.
 Select orderBy(Column col, boolean asc)
          Add the given column to the list of those in the ORDER BY clause of this statement.
 Select select(Column col)
          Add the given column to the list of those selected by this statement.
 void setRelationVariable(String var)
          Set the relation variable to use in calls to getColumnAlias(com.solarmetric.kodo.impl.jdbc.schema.Column).
 ObjectSelect traverseRelation(String name)
          Traverse into the given relation; this should be followed by the joinRelation(com.solarmetric.kodo.impl.jdbc.ormapping.Relation, com.solarmetric.kodo.impl.jdbc.schema.Column[], com.solarmetric.kodo.impl.jdbc.schema.Column[]) method call.
 SQLStatement where(Column[] cols, Object[] values)
          Set the criteria to inclde that the the given columns must equal the given values; this also adds the tables of the given columns to the tables clause of this statement.
 SQLStatement where(Column col, boolean value)
          See where(Column,Object).
 SQLStatement where(Column col, byte value)
           
 SQLStatement where(Column col, char value)
          See where(Column,Object).
 SQLStatement where(Column col, double value)
          See where(Column,Object).
 SQLStatement where(Column col, float value)
          See where(Column,Object).
 SQLStatement where(Column col, int value)
          See where(Column,Object).
 SQLStatement where(Column col, long value)
          See where(Column,Object).
 SQLStatement where(Column col, Object value)
          Set the criteria to inclde that the the given column must equal the given value; this also adds the table of the given column to the tables clause of this statement.
 SQLStatement where(Column col, short value)
          See where(Column,Object).
 SQLStatement where(SQLBuffer clause)
          Set the given clause to the WHERE part of this statement.
 
Methods inherited from class com.solarmetric.kodo.impl.jdbc.sql.Select
clearOrderBy, clearSelect, getOrderBy, getSelects, isDistinct, isUpdate, isValid, orderBy, select, selectCount, selectCount, setDistinct, setUpdate
 
Methods inherited from class com.solarmetric.kodo.impl.jdbc.sql.SQLStatement
clearTable, getClassResolver, getDictionary, getTables, not, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ObjectSelect

public ObjectSelect(DBDictionary dict,
                    ClassResolver resolver)

ObjectSelect

public ObjectSelect(ObjectSelect copy,
                    ClassResolver resolver)
Method Detail

select

public Select select(Column col)
Description copied from class: Select
Add the given column to the list of those selected by this statement. This will also add the column's table to those used by this statement.
Overrides:
select in class Select

orderBy

public Select orderBy(Column col,
                      boolean asc)
Description copied from class: Select
Add the given column to the list of those in the ORDER BY clause of this statement. This will also add the column's table to those used by this statement.
Overrides:
orderBy in class Select

where

public SQLStatement where(SQLBuffer clause)
Description copied from class: SQLStatement
Set the given clause to the WHERE part of this statement.
Overrides:
where in class SQLStatement

where

public SQLStatement where(Column col,
                          Object value)
Description copied from class: SQLStatement
Set the criteria to inclde that the the given column must equal the given value; this also adds the table of the given column to the tables clause of this statement.
Overrides:
where in class SQLStatement

where

public SQLStatement where(Column col,
                          boolean value)
Description copied from class: SQLStatement
See SQLStatement.where(Column,Object).
Overrides:
where in class SQLStatement

where

public SQLStatement where(Column col,
                          byte value)

where

public SQLStatement where(Column col,
                          char value)
Description copied from class: SQLStatement
See SQLStatement.where(Column,Object).
Overrides:
where in class SQLStatement

where

public SQLStatement where(Column col,
                          double value)
Description copied from class: SQLStatement
See SQLStatement.where(Column,Object).
Overrides:
where in class SQLStatement

where

public SQLStatement where(Column col,
                          float value)
Description copied from class: SQLStatement
See SQLStatement.where(Column,Object).
Overrides:
where in class SQLStatement

where

public SQLStatement where(Column col,
                          int value)
Description copied from class: SQLStatement
See SQLStatement.where(Column,Object).
Overrides:
where in class SQLStatement

where

public SQLStatement where(Column col,
                          long value)
Description copied from class: SQLStatement
See SQLStatement.where(Column,Object).
Overrides:
where in class SQLStatement

where

public SQLStatement where(Column col,
                          short value)
Description copied from class: SQLStatement
See SQLStatement.where(Column,Object).
Overrides:
where in class SQLStatement

where

public SQLStatement where(Column[] cols,
                          Object[] values)
Description copied from class: SQLStatement
Set the criteria to inclde that the the given columns must equal the given values; this also adds the tables of the given columns to the tables clause of this statement.
Overrides:
where in class SQLStatement

getWhere

public SQLBuffer getWhere()
Description copied from class: SQLStatement
Return the WHERE portion of the SQL statement.
Overrides:
getWhere in class SQLStatement

clear

public void clear()
Description copied from class: SQLStatement
Clear the WHERE clause and table list so that this statement can be reused.
Overrides:
clear in class Select

clearWhere

public void clearWhere()
Description copied from class: SQLStatement
Clear the WHERE clause.
Overrides:
clearWhere in class SQLStatement

and

public SQLStatement and(SQLStatement same)
Description copied from class: SQLStatement
AND the previous WHERE clause with the given one. Example: sql.where (foo).and (sql.where (bar));.
Overrides:
and in class SQLStatement

or

public SQLStatement or(SQLStatement same)
Description copied from class: SQLStatement
OR the previous WHERE clause with the given one. Example: sql.where (foo).or (sql.where (bar));.
Overrides:
or in class SQLStatement

traverseRelation

public ObjectSelect traverseRelation(String name)
Traverse into the given relation; this should be followed by the joinRelation(com.solarmetric.kodo.impl.jdbc.ormapping.Relation, com.solarmetric.kodo.impl.jdbc.schema.Column[], com.solarmetric.kodo.impl.jdbc.schema.Column[]) method call.

endRelationTraversal

public ObjectSelect endRelationTraversal()
Reset the relation path.

setRelationVariable

public void setRelationVariable(String var)
Set the relation variable to use in calls to getColumnAlias(com.solarmetric.kodo.impl.jdbc.schema.Column). Should be invoked with the name of the current variable when traversing relations or otherwise invoking FieldMapping code that might cause joinRelation(com.solarmetric.kodo.impl.jdbc.ormapping.Relation, com.solarmetric.kodo.impl.jdbc.schema.Column[], com.solarmetric.kodo.impl.jdbc.schema.Column[]) to be invoked. This value is cleared when endRelationTraversal() is invoked.

join

public ObjectSelect join(Column[] col1,
                         Column[] col2)
Join the given columns. If one of the columns joins is in the class' primary table, it should appear as the first argument.

joinRelation

public ObjectSelect joinRelation(Relation rel,
                                 Column[] col1,
                                 Column[] col2)
Join the given columns, where the second column represents the traversal into a new relation. The second column must be the one that belongs to the related object. This will look up the mapping to relate to based on rel.getRelationType()..

joinRelation

public ObjectSelect joinRelation(ClassMapping cm,
                                 Column[] col1,
                                 Column[] col2)
Join the given columns, where the second column represents the traversal into a new relation. The second column must be the one that belongs to the related object. This will use cm rather than looking it up based on the relation information.

getColumnAlias

public String getColumnAlias(Column col)
Return the alias being used for the given column, given the current series of traversed relations.

getSQLBuffer

public SQLBuffer getSQLBuffer()
Description copied from class: SQLStatement
Return the SQLBuffer to be used for exeucting the statement;
Overrides:
getSQLBuffer in class Select

SolarMetric Kodo JDO 2.4.3 generated on March 27 2003

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.