jodd.db.orm.sqlgen.chunks
Class TableChunk

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

public class TableChunk
extends SqlChunk

Table chunk resolves table name, optional alias and defines table references.

Table can be specified either by entity name or entity type. Entity name is simple type name of registered entity. Table alias is optional. Table reference is a string used in other parts of sql (i.e. chunks) to reference this table. Table reference equals to the alias if alias is defined, otherwise, reference equals to table name.

Examples:

 ("Foo", null) -> "FOO",        ref="Foo"
 ("Foo", "f")  -> "FOO f"       ref="f"
 

If previous chunk is also a table, comma separator will be added between two table definitions.

Tables must be resolved on chunk creation, before processing, since other chunks depends on it.


Field Summary
protected  DbEntityDescriptor ded
           
protected  java.lang.Class entity
           
protected  java.lang.String entityName
           
protected  java.lang.String tableAlias
           
protected  java.lang.String tableReference
           
 
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
TableChunk(java.lang.Class entity)
           
TableChunk(java.lang.Class entity, java.lang.String alias)
           
TableChunk(java.lang.String entityName)
           
TableChunk(java.lang.String entityName, java.lang.String alias)
           
 
Method Summary
 void init(DbSqlBuilder sqlBuilder)
          Registers tables.
 void process()
          Simply appends already resolved table data to the query.
 
Methods inherited from class jodd.db.orm.sqlgen.chunks.SqlChunk
defineParameter, getNextChunk, getPreviousChunk, 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

ded

protected DbEntityDescriptor ded

tableReference

protected java.lang.String tableReference

entityName

protected final java.lang.String entityName

entity

protected final java.lang.Class entity

tableAlias

protected final java.lang.String tableAlias
Constructor Detail

TableChunk

public TableChunk(java.lang.String entityName,
                  java.lang.String alias)

TableChunk

public TableChunk(java.lang.String entityName)

TableChunk

public TableChunk(java.lang.Class entity,
                  java.lang.String alias)

TableChunk

public TableChunk(java.lang.Class entity)
Method Detail

init

public void init(DbSqlBuilder sqlBuilder)
Registers tables.

Overrides:
init in class SqlChunk

process

public void process()
Simply appends already resolved table data to the query.

Specified by:
process in class SqlChunk


Copyright ©2008 Jodd Team