jodd.db.orm.sqlgen.chunks
Class ColumnChunk

java.lang.Object
  extended by jodd.db.orm.sqlgen.chunks.SqlChunk
      extended by jodd.db.orm.sqlgen.chunks.ColumnChunk

public class ColumnChunk
extends SqlChunk

Column chunk resolves entity column(s) from column references. Should be used for SELECT sql queries.

Column reference is specified as: tableReference.propertyName where property name is a property of the entity references by table reference. Result is rendered as: tableName.column or alias.column (if table has an alias).

There are some special values for propertyName

  • wildcard (*), all table columns will be listed
  • id sign (+), all table id columns will be listed

    If previous chunk is also a column chunk, comma separator will be added in between.

    Note that column alias may be appended to the column name ('as' construct).


    Field Summary
    protected  java.lang.String columnRef
               
    protected  int includeColumns
               
    protected  java.lang.String tableRef
               
     
    Fields inherited from class jodd.db.orm.sqlgen.chunks.SqlChunk
    COLS_ALL, COLS_NA, COLS_ONLY_EXISTING, COLS_ONLY_IDS, isColumnChunk, isJoinOnChunk, isTableChunk, nextChunk, previousChunk, query, sqlBuilder
     
    Constructor Summary
    ColumnChunk(java.lang.String reference)
               
    ColumnChunk(java.lang.String tableRef, boolean includeAll)
               
    ColumnChunk(java.lang.String tableRef, java.lang.String columnRef)
               
     
    Method Summary
    protected  void appendColumnName(java.lang.StringBuilder query, DbEntityDescriptor ded, java.lang.String column)
              Simply appends column name with optional table reference and alias.
     void process()
              Process the chunk and prepares the output.
     
    Methods inherited from class jodd.db.orm.sqlgen.chunks.SqlChunk
    defineParameter, getNextChunk, getPreviousChunk, init, insertChunkAfter, isColumnChunk, isJoinOnChunk, isTableChunk, lookupName, lookupTableRef, lookupType, render, resolveTableRef
     
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    tableRef

    protected final java.lang.String tableRef

    columnRef

    protected final java.lang.String columnRef

    includeColumns

    protected final int includeColumns
    Constructor Detail

    ColumnChunk

    public ColumnChunk(java.lang.String tableRef,
                       java.lang.String columnRef)

    ColumnChunk

    public ColumnChunk(java.lang.String reference)

    ColumnChunk

    public ColumnChunk(java.lang.String tableRef,
                       boolean includeAll)
    Method Detail

    process

    public void process()
    Description copied from class: SqlChunk
    Process the chunk and prepares the output.

    Specified by:
    process in class SqlChunk

    appendColumnName

    protected void appendColumnName(java.lang.StringBuilder query,
                                    DbEntityDescriptor ded,
                                    java.lang.String column)
    Simply appends column name with optional table reference and alias.



    Copyright ©2008 Jodd Team