|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.strangelight.db.TableRow | +--com.strangelight.db.KeyedRow
A TableRow row which also has a standardized primary key. The
column which must be present in a database table with
KeyedRow
s is:
id
PRIMARY KEY
of this table.
Must be of type INT
and be
declared AUTO_INCREMENT
.CREATE TABLE
definition of
a database table encapsulated by a subclass of
KeyedRow
must look something like this:
CREATE TABLE MyTableName ( id int PRIMARY KEY auto_increment, ...Applications typically subclass
KeyedRow
by defining a
TableRow.getTableName()
method and accessor methods which wrap
TableRow.getString( String )
, TableRow.setString( String, String )
,
TableRow.getObject( String )
, and/or TableRow.setObject( String,
Object )
.
JoinRow
Constructor Summary | |
KeyedRow()
Creates a new, empty KeyedRow object. |
|
KeyedRow(int id)
Fetches the KeyedRow object with the given PRIMARY
KEY (specified as an int ) from the
database. |
|
KeyedRow(java.lang.Integer id)
Fetches the KeyedRow object with the given PRIMARY
KEY (specified as an Integer object) from the
database. |
Method Summary | |
void |
commit()
Writes any changes made to this KeyedRow object back
to the database. |
void |
finalize()
|
java.lang.String |
get_id()
gets the primary key of this DB row as an int. |
java.lang.Integer |
getId()
gets the primary key of this DB row as an Integer object. |
Methods inherited from class com.strangelight.db.TableRow |
drop, getFields, getObject, getString, getTableName, getWhereClause, setObject, setString |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public KeyedRow()
KeyedRow
object. (This object
will not be written back to the database unless and
until at least one of its fields is explicitly set.)
public KeyedRow(java.lang.Integer id)
PRIMARY
KEY
(specified as an Integer object) from the
database.
id
- the PRIMARY KEY
of the desired database row.public KeyedRow(int id) throws E_NoSuchEntity
PRIMARY
KEY
(specified as an int
) from the
database.
id
- the PRIMARY KEY
of the desired database row.Method Detail |
public java.lang.Integer getId()
PRIMARY KEY
of this row as an
Integer
object, or null
if this
is a new object which has not yet been written to
the database and therefore does not yet have a
PRIMARY KEY
.public java.lang.String get_id()
PRIMARY KEY
of this row as a
String
, or null
if this is a new
object which has not yet been written to the database and
therefore does not yet have a PRIMARY KEY
.public void commit()
KeyedRow
object back
to the database. If this is a newly-created row, then
commit()
also fetches the newly-generated
PRIMARY KEY
back from the database. Note that this method is called automatically during garbage-collection.
commit
in class TableRow
public void finalize()
finalize
in class TableRow
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |