public abstract class BaseRecord extends java.lang.Object implements Record
Record
interface.
This class is meant as a convenience so that not all methods need to be implmented. Simply
implement those needed by overriding the necessary ones.WITH_BLOBS, WITHOUT_BLOBS
Constructor and Description |
---|
BaseRecord() |
Modifier and Type | Method and Description |
---|---|
java.sql.PreparedStatement |
getDeleteStatment(java.sql.Connection c,
java.lang.Object record)
Get a statement suitable to delete a given object from the database
Override this method in subclasses as required
|
java.sql.PreparedStatement |
getInsertStatment(java.sql.Connection c,
java.lang.Object record)
Get a statement suitable to insert a given object to the database
Override this method in subclasses as required
|
java.sql.PreparedStatement |
getInsertStmt(java.sql.Connection c,
java.lang.Object record,
int autoGeneratedKeys)
Get a statement suitable to insert a given object to the database
|
java.lang.String |
getTableName()
Get the name of the database table this record references
Override this method in subclasses as required
|
java.sql.PreparedStatement |
getUpdateStatment(java.sql.Connection c,
java.lang.Object record)
Get a statement suitable to update a given object in the database
Override this method in subclasses as required
|
java.lang.Object |
toObject(java.sql.ResultSet resultSet,
boolean includeBlobs)
Get contents of this record as an object
Override this method in subclasses as required
|
public java.sql.PreparedStatement getDeleteStatment(java.sql.Connection c, java.lang.Object record) throws java.lang.Exception
Override this method in subclasses as required
getDeleteStatment
in interface Record
c
- the database connection to use for the deleterecord
- the object to deletejava.lang.Exception
public java.sql.PreparedStatement getInsertStatment(java.sql.Connection c, java.lang.Object record) throws java.lang.Exception
Override this method in subclasses as required
getInsertStatment
in interface Record
c
- the database connection to use for the insertrecord
- the object to insertjava.lang.Exception
public java.sql.PreparedStatement getInsertStmt(java.sql.Connection c, java.lang.Object record, int autoGeneratedKeys) throws java.lang.Exception
getInsertStmt
in interface Record
c
- the database connection to use for the insertrecord
- the object to insertautoGeneratedKeys
- a flag indicating whether auto-generated keys should be returned;
one of Statement.RETURN_GENERATED_KEYS or Statement.NO_GENERATED_KEYSjava.lang.Exception
public java.lang.String getTableName()
Override this method in subclasses as required
getTableName
in interface Record
public java.sql.PreparedStatement getUpdateStatment(java.sql.Connection c, java.lang.Object record) throws java.lang.Exception
Override this method in subclasses as required
getUpdateStatment
in interface Record
c
- the database connection to use for the updaterecord
- the object to updatejava.lang.Exception
public java.lang.Object toObject(java.sql.ResultSet resultSet, boolean includeBlobs) throws java.lang.Exception
Override this method in subclasses as required