|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.mathema.pride.DatabaseAdapter
public abstract class DatabaseAdapter
Convenience baseclass, providing a set of simple methods for
interaction between the database and data entity objects. Most
of the functions get an object 'entity' passed as the first
parameter which is the data entity to extract data from for
database manipulation resp. to pass data to returned from
database queries.
This class is of minor importance. The derived types MappedObject
or ValueObjectAdapter
are usually sufficient and easier to use.
Field Summary | |
---|---|
static java.lang.String |
REVISION_ID
|
Constructor Summary | |
---|---|
DatabaseAdapter()
|
Method Summary | |
---|---|
protected static void |
commit(RecordDescriptor red)
|
protected java.lang.String |
constraint(java.lang.Object entity,
java.lang.String[] dbfields,
boolean byLike,
RecordDescriptor red)
Assembles an SQL constraint which would be used as a WHERE clause in a query. |
protected static void |
create(java.lang.Object entity,
ExtensionDescriptor xd)
|
protected static int |
create(java.lang.Object entity,
RecordDescriptor red)
Create a new record. |
protected static int |
create(java.lang.Object entity,
java.lang.String[] autoFields,
RecordDescriptor red)
Like function above but additionally allows to pass a set of fields which should be excluded from the SQL insert command. |
protected static int |
delete(java.lang.Object entity,
RecordDescriptor red)
|
protected static int |
delete(java.lang.Object entity,
java.lang.String[] dbkeyfields,
RecordDescriptor red)
|
protected static void |
fetch(java.lang.Object entity,
ExtensionDescriptor xd)
|
protected static void |
fetch(java.lang.Object entity,
ExtensionDescriptor xd,
java.lang.String attrName)
|
protected static void |
fetch(java.lang.Object entity,
ExtensionDescriptor xd,
java.lang.String[] attrNames)
|
protected static void |
fetch(java.lang.Object entity,
java.lang.Object key,
RecordDescriptor red)
Fetch an object by key. |
protected static void |
find(java.lang.Object entity,
RecordDescriptor red)
Same like query() but takes the first record only |
protected static void |
find(java.lang.Object entity,
java.lang.String[] dbfields,
RecordDescriptor red)
Same like query() but takes the first record only |
protected static void |
find(java.lang.Object entity,
java.lang.String where,
RecordDescriptor red)
Same like query() but takes the first record only |
protected static Database |
getDatabase(ExtensionDescriptor xd)
|
protected static Database |
getDatabase(RecordDescriptor red)
|
protected static void |
process(java.lang.Exception x,
RecordDescriptor red)
|
protected static ResultIterator |
query(java.lang.Object entity,
java.lang.String[] dbfields,
RecordDescriptor red)
Fetch an object by fields. |
protected static ResultIterator |
query(java.lang.Object entity,
java.lang.String where,
RecordDescriptor red)
Fetch an object by a self-made where clause |
protected static ResultIterator |
queryAll(java.lang.Object entity,
RecordDescriptor red)
Fetch all objects |
protected static void |
update(java.lang.Object entity,
ExtensionDescriptor xd)
|
protected static void |
update(java.lang.Object entity,
ExtensionDescriptor xd,
java.lang.String attrName)
|
protected static void |
update(java.lang.Object entity,
ExtensionDescriptor xd,
java.lang.String[] attrNames)
|
protected static int |
update(java.lang.Object entity,
RecordDescriptor red)
|
protected static int |
update(java.lang.Object entity,
java.lang.String[] dbkeyfields,
RecordDescriptor red)
|
protected static int |
update(java.lang.Object entity,
java.lang.String[] dbkeyfields,
java.lang.String[] updatefields,
RecordDescriptor red)
|
protected static int |
update(java.lang.Object entity,
java.lang.String where,
RecordDescriptor red)
|
protected static int |
update(java.lang.Object entity,
java.lang.String where,
java.lang.String[] updatefields,
RecordDescriptor red)
|
protected static ResultIterator |
wildcard(java.lang.Object entity,
java.lang.String[] dbfields,
RecordDescriptor red)
Same like query() but performs a wildcard search |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String REVISION_ID
Constructor Detail |
---|
public DatabaseAdapter()
Method Detail |
---|
protected static Database getDatabase(RecordDescriptor red)
protected static Database getDatabase(ExtensionDescriptor xd)
protected static void fetch(java.lang.Object entity, java.lang.Object key, RecordDescriptor red) throws java.sql.SQLException
java.sql.SQLException
protected static ResultIterator query(java.lang.Object entity, java.lang.String[] dbfields, RecordDescriptor red) throws java.sql.SQLException
java.sql.SQLException
protected static ResultIterator wildcard(java.lang.Object entity, java.lang.String[] dbfields, RecordDescriptor red) throws java.sql.SQLException
query()
but performs a wildcard search
java.sql.SQLException
protected static void find(java.lang.Object entity, java.lang.String[] dbfields, RecordDescriptor red) throws java.sql.SQLException
query()
but takes the first record only
java.sql.SQLException
protected static void find(java.lang.Object entity, RecordDescriptor red) throws java.sql.SQLException
query()
but takes the first record only
java.sql.SQLException
protected static ResultIterator queryAll(java.lang.Object entity, RecordDescriptor red) throws java.sql.SQLException
java.sql.SQLException
protected static ResultIterator query(java.lang.Object entity, java.lang.String where, RecordDescriptor red) throws java.sql.SQLException
java.sql.SQLException
protected static void find(java.lang.Object entity, java.lang.String where, RecordDescriptor red) throws java.sql.SQLException
query()
but takes the first record only
java.sql.SQLException
protected static int update(java.lang.Object entity, RecordDescriptor red) throws java.sql.SQLException
java.sql.SQLException
protected static int update(java.lang.Object entity, java.lang.String[] dbkeyfields, RecordDescriptor red) throws java.sql.SQLException
java.sql.SQLException
protected static int update(java.lang.Object entity, java.lang.String[] dbkeyfields, java.lang.String[] updatefields, RecordDescriptor red) throws java.sql.SQLException
java.sql.SQLException
protected static int update(java.lang.Object entity, java.lang.String where, RecordDescriptor red) throws java.sql.SQLException
java.sql.SQLException
protected static int update(java.lang.Object entity, java.lang.String where, java.lang.String[] updatefields, RecordDescriptor red) throws java.sql.SQLException
java.sql.SQLException
protected static int create(java.lang.Object entity, RecordDescriptor red) throws java.sql.SQLException
RecordDescriptor
java.sql.SQLException
protected static int create(java.lang.Object entity, java.lang.String[] autoFields, RecordDescriptor red) throws java.sql.SQLException
java.sql.SQLException
protected static int delete(java.lang.Object entity, RecordDescriptor red) throws java.sql.SQLException
java.sql.SQLException
protected static int delete(java.lang.Object entity, java.lang.String[] dbkeyfields, RecordDescriptor red) throws java.sql.SQLException
java.sql.SQLException
protected java.lang.String constraint(java.lang.Object entity, java.lang.String[] dbfields, boolean byLike, RecordDescriptor red)
entity
- The object to take the attribute values fromdbfields
- The database fields to considerbyLike
- Use the like
operator if setred
- The RecordDescriptor
providing the attribute mappings
protected static void commit(RecordDescriptor red) throws java.sql.SQLException
java.sql.SQLException
protected static void process(java.lang.Exception x, RecordDescriptor red) throws java.sql.SQLException
java.sql.SQLException
protected static void update(java.lang.Object entity, ExtensionDescriptor xd) throws java.sql.SQLException
java.sql.SQLException
protected static void update(java.lang.Object entity, ExtensionDescriptor xd, java.lang.String attrName) throws java.sql.SQLException
java.sql.SQLException
protected static void update(java.lang.Object entity, ExtensionDescriptor xd, java.lang.String[] attrNames) throws java.sql.SQLException
java.sql.SQLException
protected static void fetch(java.lang.Object entity, ExtensionDescriptor xd) throws java.sql.SQLException
java.sql.SQLException
protected static void fetch(java.lang.Object entity, ExtensionDescriptor xd, java.lang.String attrName) throws java.sql.SQLException
java.sql.SQLException
protected static void fetch(java.lang.Object entity, ExtensionDescriptor xd, java.lang.String[] attrNames) throws java.sql.SQLException
java.sql.SQLException
protected static void create(java.lang.Object entity, ExtensionDescriptor xd) throws java.sql.SQLException
java.sql.SQLException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |