de.mathema.pride
Class DatabaseRecord

java.lang.Object
  extended by de.mathema.pride.DatabaseAdapter
      extended by de.mathema.pride.DatabaseRecord

public abstract class DatabaseRecord
extends DatabaseAdapter

Convenience baseclass, providing a set of simple methods for interaction between the database and data entity objects. This is a derivation from DatabaseAdapter assuming that the entity to pass is the object itself.

Author:
Jan Lessner

Field Summary
static java.lang.String REVISION_ID
           
 
Constructor Summary
DatabaseRecord()
           
 
Method Summary
protected  java.lang.String constraint(java.lang.String[] dbfields, boolean byLike, RecordDescriptor red)
           
protected  void create(ExtensionDescriptor xd)
           
protected  int create(RecordDescriptor dbd)
          Create a record from this entity
protected  int create(java.lang.String[] autoFields, RecordDescriptor dbd)
          Create a record from this entity
protected  int delete(RecordDescriptor dbd)
          Delete the record matching this entitie's primary key
protected  int delete(java.lang.String[] dbkeyfields, RecordDescriptor dbd)
          Delete all records matching the fields refered to by dbkeyfields
protected  void fetch(ExtensionDescriptor xd)
           
protected  void fetch(ExtensionDescriptor xd, java.lang.String attrName)
           
protected  void fetch(ExtensionDescriptor xd, java.lang.String[] attrNames)
           
protected  void fetch(java.lang.Object key, RecordDescriptor dbd)
          Fetch an object by key.
protected  void find(RecordDescriptor dbd)
          Same like find() above but takes the first attribute as key
protected  void find(java.lang.String[] dbfields, RecordDescriptor dbd)
          Same like query() but takes the first record only
protected  void find(java.lang.String where, RecordDescriptor dbd)
          Same like query() but takes the first record only
protected  ResultIterator query(java.lang.String[] dbfields, RecordDescriptor dbd)
          Fetch an object by fields.
protected  ResultIterator query(java.lang.String where, RecordDescriptor dbd)
          Fetch an object by a self-made where clause
protected  ResultIterator queryAll(RecordDescriptor dbd)
          Fetch all objects
protected  void update(ExtensionDescriptor xd)
           
protected  void update(ExtensionDescriptor xd, java.lang.String attrName)
           
protected  void update(ExtensionDescriptor xd, java.lang.String[] attrNames)
           
protected  int update(RecordDescriptor dbd)
          Update a record from this entitie's content
protected  int update(java.lang.String[] dbkeyfields, RecordDescriptor dbd)
          Same like above but updates all object's matching the fields refered to by dbkeyfields
protected  int update(java.lang.String where, RecordDescriptor dbd)
           
protected  ResultIterator wildcard(java.lang.String[] dbfields, RecordDescriptor dbd)
          Same like query() but performs a wildcard search
 
Methods inherited from class de.mathema.pride.DatabaseAdapter
commit, constraint, create, create, create, delete, delete, fetch, fetch, fetch, fetch, find, find, find, getDatabase, getDatabase, process, query, query, queryAll, update, update, update, update, update, update, update, update, wildcard
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

REVISION_ID

public static final java.lang.String REVISION_ID
See Also:
Constant Field Values
Constructor Detail

DatabaseRecord

public DatabaseRecord()
Method Detail

fetch

protected void fetch(java.lang.Object key,
                     RecordDescriptor dbd)
              throws java.sql.SQLException
Fetch an object by key.

Throws:
java.sql.SQLException

query

protected ResultIterator query(java.lang.String[] dbfields,
                               RecordDescriptor dbd)
                        throws java.sql.SQLException
Fetch an object by fields. The values are taken from the fields' accociated get-methods

Throws:
java.sql.SQLException

wildcard

protected ResultIterator wildcard(java.lang.String[] dbfields,
                                  RecordDescriptor dbd)
                           throws java.sql.SQLException
Same like query() but performs a wildcard search

Throws:
java.sql.SQLException

find

protected void find(java.lang.String[] dbfields,
                    RecordDescriptor dbd)
             throws java.sql.SQLException
Same like query() but takes the first record only

Throws:
java.sql.SQLException

find

protected void find(RecordDescriptor dbd)
             throws java.sql.SQLException
Same like find() above but takes the first attribute as key

Throws:
java.sql.SQLException

queryAll

protected ResultIterator queryAll(RecordDescriptor dbd)
                           throws java.sql.SQLException
Fetch all objects

Throws:
java.sql.SQLException

query

protected ResultIterator query(java.lang.String where,
                               RecordDescriptor dbd)
                        throws java.sql.SQLException
Fetch an object by a self-made where clause

Throws:
java.sql.SQLException

find

protected void find(java.lang.String where,
                    RecordDescriptor dbd)
             throws java.sql.SQLException
Same like query() but takes the first record only

Throws:
java.sql.SQLException

update

protected int update(RecordDescriptor dbd)
              throws java.sql.SQLException
Update a record from this entitie's content

Throws:
java.sql.SQLException

update

protected int update(java.lang.String[] dbkeyfields,
                     RecordDescriptor dbd)
              throws java.sql.SQLException
Same like above but updates all object's matching the fields refered to by dbkeyfields

Throws:
java.sql.SQLException

update

protected int update(java.lang.String where,
                     RecordDescriptor dbd)
              throws java.sql.SQLException
Throws:
java.sql.SQLException

create

protected int create(RecordDescriptor dbd)
              throws java.sql.SQLException
Create a record from this entity

Throws:
java.sql.SQLException

create

protected int create(java.lang.String[] autoFields,
                     RecordDescriptor dbd)
              throws java.sql.SQLException
Create a record from this entity

Throws:
java.sql.SQLException

delete

protected int delete(RecordDescriptor dbd)
              throws java.sql.SQLException
Delete the record matching this entitie's primary key

Throws:
java.sql.SQLException

delete

protected int delete(java.lang.String[] dbkeyfields,
                     RecordDescriptor dbd)
              throws java.sql.SQLException
Delete all records matching the fields refered to by dbkeyfields

Throws:
java.sql.SQLException

constraint

protected java.lang.String constraint(java.lang.String[] dbfields,
                                      boolean byLike,
                                      RecordDescriptor red)

update

protected void update(ExtensionDescriptor xd)
               throws java.sql.SQLException
Throws:
java.sql.SQLException

update

protected void update(ExtensionDescriptor xd,
                      java.lang.String attrName)
               throws java.sql.SQLException
Throws:
java.sql.SQLException

update

protected void update(ExtensionDescriptor xd,
                      java.lang.String[] attrNames)
               throws java.sql.SQLException
Throws:
java.sql.SQLException

fetch

protected void fetch(ExtensionDescriptor xd)
              throws java.sql.SQLException
Throws:
java.sql.SQLException

fetch

protected void fetch(ExtensionDescriptor xd,
                     java.lang.String attrName)
              throws java.sql.SQLException
Throws:
java.sql.SQLException

fetch

protected void fetch(ExtensionDescriptor xd,
                     java.lang.String[] attrNames)
              throws java.sql.SQLException
Throws:
java.sql.SQLException

create

protected void create(ExtensionDescriptor xd)
               throws java.sql.SQLException
Throws:
java.sql.SQLException