de.esprit.appsuite.database.dbase

## Interface DBPersistent

- All Superinterfaces:
    java.lang.Cloneable, DeepCloneable, Dumpable, java.io.Serializable
  All Known Subinterfaces:
    DBRecord
  All Known Implementing Classes:
    AbstractDatabaseGroup, AbstractDatabaseUser, AbstractDBRecordABO, ComposedRecord, DatabaseUser, DBGroup, DBO_esprit_group, DBO_esprit_user, DBO_esprit_userlist_view, DBO_insert_def, DBO_tnt_alltype, DBO_tnt_logmsg, DBO_tnt_nopk, DBO_tnt_persistent_type, DBO_tnt_pk_composed, DBO_tnt_pktype, DBO_tnt_route, DBO_tnt_route_vertex, DBO_tnt_stdtype, DBO_tnt_tank, DBObject, DBRecordWrapper

      public interface DBPersistent
      extends java.io.Serializable, DeepCloneable, Dumpable

  This class should be implemented by all Objects that are database persistent.
  Author:
    Rainer Buesch

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `dbDelete()` Deletes the representing record from the database.
    `void` | `dbInsert()` Inserts the object as a record into the database.
    `void` | `dbLoad(DBLoadMonitor monitor, SqlCondition condition)` Reads a set of objects from from the database according to the given condition.
    `void` | `dbLoad(DBLoadMonitor monitor, SqlCondition condition, SqlOrder order)` Reads a set of objects from from the database according to the given condition and order.
    `void` | `dbRehash()` Re-reads the object state from the database.
    `void` | `dbSearch(DBLoadMonitor monitor, SqlCondition condition)` Reads a set of objects from from the database according to the given condition.
    `void` | `dbSearch(DBLoadMonitor monitor, SqlCondition condition, SqlOrder order)` Reads a set of objects from from the database according to the given condition and order.
    `<R extends DBRecord> R[]` | `dbSearch(SqlCondition condition)` Reads a set of objects from from the database according to the given condition.
    `<R extends DBRecord> R[]` | `dbSearch(SqlCondition condition, SqlOrder order)` Reads a set of objects from from the database according to the given condition and order.
    `<R extends DBRecord> R[]` | `dbSelect(SqlCondition condition)` Reads a set of objects from from the database according to the given condition.
    `<R extends DBRecord> R[]` | `dbSelect(SqlCondition condition, SqlOrder order)` Reads a set of objects from from the database according to the given condition and order.
    `void` | `dbUpdate()` Writes the object's current state to the database.
    `boolean` | `exists()` Checks whether a matching object can be found in the database by performing a primary key lookup in the according table(s).
    `int` | `getPrimaryKeyCount()` Returns the number of fields that compose the primary key
    `java.lang.String[]` | `getPrimaryKeyValues()` Returns the values of the primary key as a String array.
    `java.lang.String` | `getRecordName()` Returns a unique name for this record, which is usually the tablename.
    `boolean` | `hasPrimaryKey()` Tells whether this object has a primary key at all
    `boolean` | `isDirty()` Tells whether this object is in sync with the database.
    `void` | `setPrimaryKeyValues(java.lang.String... pkValues)` Sets the values of the primary key.

    - ### Methods inherited from interface de.esprit.common.type.DeepCloneable

      `deepClone`

    - ### Methods inherited from interface de.esprit.common.type.Dumpable

      `toDumpString, toDumpString, toString, toString`

- - ### Method Detail

    - #### hasPrimaryKey

          boolean hasPrimaryKey()

      Tells whether this object has a primary key at all

    - #### getPrimaryKeyCount

          int getPrimaryKeyCount()

      Returns the number of fields that compose the primary key

    - #### getPrimaryKeyValues

          java.lang.String[] getPrimaryKeyValues()

      Returns the values of the primary key as a String array. Note that the primary key must consist of data types that are representable by a String!

    - #### setPrimaryKeyValues

          void setPrimaryKeyValues(java.lang.String... pkValues)

      Sets the values of the primary key. Note that the order of the array elements must match the primary key definition in the table.

    - #### dbUpdate

          void dbUpdate()
                        throws java.lang.Exception

      Writes the object's current state to the database. After this action the state of the object will be valid.
      Throws:
        `java.lang.Exception`
      See Also:
        `isDirty()`

    - #### dbInsert

          void dbInsert()
                        throws java.lang.Exception

      Inserts the object as a record into the database.
      Throws:
        `java.lang.Exception`

    - #### dbDelete

          void dbDelete()
                        throws java.lang.Exception

      Deletes the representing record from the database. After this action the state of the object will be invalid.
      Throws:
        `java.lang.Exception`
      See Also:
        `isDirty()`

    - #### dbRehash

          void dbRehash()
                        throws java.lang.Exception

      Re-reads the object state from the database. After this action the state of the object will be valid.
      Throws:
        `java.lang.Exception`
      See Also:
        `isDirty()`

    - #### dbSelect

          <R extends DBRecord> R[] dbSelect(SqlCondition condition)
                                        throws java.lang.Exception

      Reads a set of objects from from the database according to the given condition. The default ordering is by primary key.
      Throws:
        `java.lang.Exception`

    - #### dbSelect

          <R extends DBRecord> R[] dbSelect(SqlCondition condition,
                                          SqlOrder order)
                                        throws java.lang.Exception

      Reads a set of objects from from the database according to the given condition and order.
      Throws:
        `java.lang.Exception`

    - #### dbLoad

          void dbLoad(DBLoadMonitor monitor,
                    SqlCondition condition)
                      throws java.lang.Exception

      Reads a set of objects from from the database according to the given condition. The default ordering is by primary key.
      Throws:
        `java.lang.Exception`

    - #### dbLoad

          void dbLoad(DBLoadMonitor monitor,
                    SqlCondition condition,
                    SqlOrder order)
                      throws java.lang.Exception

      Reads a set of objects from from the database according to the given condition and order.
      Throws:
        `java.lang.Exception`

    - #### dbSearch

          <R extends DBRecord> R[] dbSearch(SqlCondition condition)
                                        throws java.lang.Exception

      Reads a set of objects from from the database according to the given condition. The default ordering is by primary key.
      Throws:
        `java.lang.Exception`

    - #### dbSearch

          <R extends DBRecord> R[] dbSearch(SqlCondition condition,
                                          SqlOrder order)
                                        throws java.lang.Exception

      Reads a set of objects from from the database according to the given condition and order.
      Throws:
        `java.lang.Exception`

    - #### dbSearch

          void dbSearch(DBLoadMonitor monitor,
                      SqlCondition condition)
                        throws java.lang.Exception

      Reads a set of objects from from the database according to the given condition. The default ordering is by primary key.
      Throws:
        `java.lang.Exception`

    - #### dbSearch

          void dbSearch(DBLoadMonitor monitor,
                      SqlCondition condition,
                      SqlOrder order)
                        throws java.lang.Exception

      Reads a set of objects from from the database according to the given condition and order.
      Throws:
        `java.lang.Exception`

    - #### exists

          boolean exists()

      Checks whether a matching object can be found in the database by performing a primary key lookup in the according table(s). Does not change the object itself in any way.

    - #### isDirty

          boolean isDirty()

      Tells whether this object is in sync with the database. If it has been modified since the last rehash it will be in a dirty state.

    - #### getRecordName

          java.lang.String getRecordName()

      Returns a unique name for this record, which is usually the tablename. On more complex composed persistent objects this may be any other identifying name.

Copyright © 2014 EsprIT-Systems. All Rights Reserved.