Class jora.Table
java.lang.Object
|
+----jora.Table
- public class Table
- extends java.lang.Object
Table class is used to establish mapping between corteges of database
tables and Java classes. This class is responsible for constructing
SQL statements for extracting, updating and deleting records of the
database table.
Field Summary
|
static java.lang.String
|
fieldSeparator
Spearator of name components of compound field.
|
Constructor Summary
|
Table(java.lang.String className,
java.lang.String tableName,
Session s,
java.lang.String key)
Constructor for table object.
|
Table(java.lang.String className,
Session s,
java.lang.String key)
Constructor for table object.
|
Table(java.lang.String className,
Session s)
Constructor of table without explicit key specification.
|
Table(java.lang.String className)
Constructor of table with "key" and "session" parameters inherited
from base table.
|
Method Summary
|
void
|
delete(java.lang.Object obj)
Delete record with specified value of primary key from the table.
|
void
|
insert(java.lang.Object obj)
Insert new record in the table.
|
Cursor
|
queryAllByExample(java.lang.Object obj)
Select records from specified and derived database tables using
obj object as template for selection.
|
Cursor
|
queryByExample(java.lang.Object obj)
Select records from database table using obj object as
template for selection.
|
Cursor
|
select(java.lang.String condition)
Select records from database table according to search condition
|
Cursor
|
selectAll(java.lang.String condition)
Select records from specified and derived database tables
|
void
|
update(java.lang.Object obj)
Update record in the table using table's primary key to locate
record in the table and values of fields of specified object obj
to alter record fields.
|
Methods inherited from class java.lang.Object
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
fieldSeparator
public static java.lang.String fieldSeparator
- Spearator of name components of compound field. For example, if Java
class constains component "location" of Point class, which
has two components "x" and "y", then database table should
have columns "location_x" and "location_y" (if '_' is used
as separator)
Table
public Table(java.lang.String className,
java.lang.String tableName,
Session s,
java.lang.String key)
- Constructor for table object. Make association between Java class
and database table.
- Parameters:
tclassName
- name of Java class
tableName
- name of database table mapped on this Java class
key
- table primary key. This parameter is used in UPDATE/DELETE
operations to locate record in the table.
Table
public Table(java.lang.String className,
Session s,
java.lang.String key)
- Constructor for table object. Make association between Java class
and database table. Name of Java class should be the same as name of
the database table
- Parameters:
className
- name of Java class, which should be (without
package prefix) be the same as the name of database table.
key
- table primary key. This parameter is used in UPDATE/DELETE
operations to locate record in the table.
Table
public Table(java.lang.String className,
Session s)
- Constructor of table without explicit key specification.
Specification of key is necessary for update/remove operations.
If key is not specified, it is inherited from base table (if any).
Table
public Table(java.lang.String className)
- Constructor of table with "key" and "session" parameters inherited
from base table.
select
public final Cursor select(java.lang.String condition)
- Select records from database table according to search condition
- Parameters:
condition
- valid SQL condition expression started with WHERE
or empty string if all records should be fetched.
selectAll
public final Cursor selectAll(java.lang.String condition)
- Select records from specified and derived database tables
- Parameters:
condition
- valid SQL condition expression started with WHERE
or empty string if all records should be fetched.
queryByExample
public final Cursor queryByExample(java.lang.Object obj)
- Select records from database table using obj object as
template for selection. All non-builtin fields of this object,
which are not null, are compared with correspondent table values.
- Parameters:
obj
- object for construction search condition: selected objects
should match all non-null fields of specified object.
queryAllByExample
public final Cursor queryAllByExample(java.lang.Object obj)
- Select records from specified and derived database tables using
obj object as template for selection.
All non-builtin fields of this object,
which are not null, are compared with correspondent table values.
- Parameters:
obj
- object for construction search condition: selected objects
should match all non-null fields of specified object.
insert
public void insert(java.lang.Object obj)
- Insert new record in the table. Values of inserted record fields
are taken from specifed object.
- Parameters:
obj
- object specifing values of inserted record fields
update
public void update(java.lang.Object obj)
- Update record in the table using table's primary key to locate
record in the table and values of fields of specified object obj
to alter record fields.
- Parameters:
obj
- object specifing value of primary key and new values of
updated record fields
delete
public void delete(java.lang.Object obj)
- Delete record with specified value of primary key from the table.
- Parameters:
obj
- object containing value of primary key.