nxt.db

## Class EntityDbTable<T>

- java.lang.Object
- - nxt.db.Table
  - - nxt.db.DerivedDbTable
    - - nxt.db.EntityDbTable<T>

- Direct Known Subclasses:
    PersistentDbTable, VersionedEntityDbTable

      public abstract class EntityDbTable<T>
      extends DerivedDbTable

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected DbKey.Factory<T>` | `dbKeyFactory`
    `protected static DbClause` | `LATEST`

    - ### Fields inherited from class nxt.db.Table

      `db, schema, schemaTable, table`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `EntityDbTable(java.lang.String schemaTable, DbKey.Factory<T> dbKeyFactory)`
    `protected` | `EntityDbTable(java.lang.String schemaTable, DbKey.Factory<T> dbKeyFactory, java.lang.String fullTextSearchColumns)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `checkAvailable(int height)`
    `protected void` | `clearCache()`
    `void` | `createSearchIndex(java.sql.Connection con)`
    `protected java.lang.String` | `defaultSort()`
    `T` | `get(DbKey dbKey)`
    `T` | `get(DbKey dbKey, boolean cache)`
    `T` | `get(DbKey dbKey, int height)`
    `DbIterator<T>` | `getAll(int from, int to)`
    `DbIterator<T>` | `getAll(int height, int from, int to)`
    `DbIterator<T>` | `getAll(int height, int from, int to, java.lang.String sort)`
    `DbIterator<T>` | `getAll(int from, int to, java.lang.String sort)`
    `T` | `getBy(DbClause dbClause)`
    `T` | `getBy(DbClause dbClause, int height)`
    `int` | `getCount()`
    `int` | `getCount(DbClause dbClause)`
    `int` | `getCount(DbClause dbClause, int height)`
    `DbIterator<T>` | `getManyBy(java.sql.Connection con, java.sql.PreparedStatement pstmt, boolean cache)`
    `DbIterator<T>` | `getManyBy(DbClause dbClause, int from, int to)`
    `DbIterator<T>` | `getManyBy(DbClause dbClause, int height, int from, int to)`
    `DbIterator<T>` | `getManyBy(DbClause dbClause, int height, int from, int to, java.lang.String sort)`
    `DbIterator<T>` | `getManyBy(DbClause dbClause, int from, int to, java.lang.String sort)`
    `void` | `insert(T t)`
    `protected abstract T` | `load(java.sql.Connection con, java.sql.ResultSet rs, DbKey dbKey)`
    `T` | `newEntity(DbKey dbKey)`
    `void` | `popOffTo(int height)`
    `protected abstract void` | `save(java.sql.Connection con, T t)`
    `DbIterator<T>` | `search(java.lang.String query, DbClause dbClause, int from, int to)`
    `DbIterator<T>` | `search(java.lang.String query, DbClause dbClause, int from, int to, java.lang.String sort)`
    `void` | `trim(int height)`

    - ### Methods inherited from class nxt.db.DerivedDbTable

      `isPersistent, rollback, truncate`

    - ### Methods inherited from class nxt.db.Table

      `getConnection, getCount, getRowCount, getSchemaTable, toString`

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

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

- - ### Field Detail

    - #### LATEST

          protected static final DbClause LATEST

    - #### dbKeyFactory

          protected final DbKey.Factory<T> dbKeyFactory

  - ### Constructor Detail

    - #### EntityDbTable

          protected EntityDbTable(java.lang.String schemaTable,
                                  DbKey.Factory<T> dbKeyFactory)

    - #### EntityDbTable

          protected EntityDbTable(java.lang.String schemaTable,
                                  DbKey.Factory<T> dbKeyFactory,
                                  java.lang.String fullTextSearchColumns)

  - ### Method Detail

    - #### load

          protected abstract T load(java.sql.Connection con,
                                    java.sql.ResultSet rs,
                                    DbKey dbKey)
                             throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### save

          protected abstract void save(java.sql.Connection con,
                                       T t)
                                throws java.sql.SQLException

      Throws:
        `java.sql.SQLException`

    - #### defaultSort

          protected java.lang.String defaultSort()

    - #### clearCache

          protected void clearCache()

    - #### checkAvailable

          public void checkAvailable(int height)

    - #### newEntity

          public final T newEntity(DbKey dbKey)

    - #### get

          public final T get(DbKey dbKey)

    - #### get

          public final T get(DbKey dbKey,
                             boolean cache)

    - #### get

          public final T get(DbKey dbKey,
                             int height)

    - #### getBy

          public final T getBy(DbClause dbClause)

    - #### getBy

          public final T getBy(DbClause dbClause,
                               int height)

    - #### getManyBy

          public final DbIterator<T> getManyBy(DbClause dbClause,
                                               int from,
                                               int to)

    - #### getManyBy

          public final DbIterator<T> getManyBy(DbClause dbClause,
                                               int from,
                                               int to,
                                               java.lang.String sort)

    - #### getManyBy

          public final DbIterator<T> getManyBy(DbClause dbClause,
                                               int height,
                                               int from,
                                               int to)

    - #### getManyBy

          public final DbIterator<T> getManyBy(DbClause dbClause,
                                               int height,
                                               int from,
                                               int to,
                                               java.lang.String sort)

    - #### getManyBy

          public final DbIterator<T> getManyBy(java.sql.Connection con,
                                               java.sql.PreparedStatement pstmt,
                                               boolean cache)

    - #### search

          public final DbIterator<T> search(java.lang.String query,
                                            DbClause dbClause,
                                            int from,
                                            int to)

    - #### search

          public final DbIterator<T> search(java.lang.String query,
                                            DbClause dbClause,
                                            int from,
                                            int to,
                                            java.lang.String sort)

    - #### getAll

          public final DbIterator<T> getAll(int from,
                                            int to)

    - #### getAll

          public final DbIterator<T> getAll(int from,
                                            int to,
                                            java.lang.String sort)

    - #### getAll

          public final DbIterator<T> getAll(int height,
                                            int from,
                                            int to)

    - #### getAll

          public final DbIterator<T> getAll(int height,
                                            int from,
                                            int to,
                                            java.lang.String sort)

    - #### getCount

          public final int getCount()

      Overrides:
        `getCount` in class `Table`

    - #### getCount

          public final int getCount(DbClause dbClause)

      Overrides:
        `getCount` in class `Table`

    - #### getCount

          public final int getCount(DbClause dbClause,
                                    int height)

    - #### insert

          public final void insert(T t)

    - #### popOffTo

          public void popOffTo(int height)

      Overrides:
        `popOffTo` in class `DerivedDbTable`

    - #### trim

          public void trim(int height)

      Overrides:
        `trim` in class `DerivedDbTable`

    - #### createSearchIndex

          public final void createSearchIndex(java.sql.Connection con)
                                       throws java.sql.SQLException

      Overrides:
        `createSearchIndex` in class `DerivedDbTable`
      Throws:
        `java.sql.SQLException`