public interface DataControl<T>
Used to implement DataControl for Data objects
Implementation has the specific information on how to write/read data with a data source
to a data store. The DataControl is used from a class which implements DataController
which takes the data object as parameter and has some mechanism to find the DataControl implementation
belonging to the DataObject.
You would not refer to a DataControl directly in you code. You would just get and set the data object
to the general DataController and leave it to the DataController to invoke the
DataControl and handle the read/write of the data.
This interface is defined in general terms because no assumptions should be made about the type of datastore. The most simple implementation would be using a JDBC connection, but you could also use it for XML or flat file datastorage
Classes which implement this interface can be generated by Sql2Class project
| Modifier and Type | Method and Description |
|---|---|
int |
delete()
Delete the data object from the datatore on primary key.
|
int |
insert()
insert a data object
|
T |
retrieve()
retrieve a data object on the basis of the primary key contained in Object o
|
java.util.List<T> |
retrieveList(Condition con)
retrieve all records meeting the values set in
Condition. |
int |
update()
Update the data object on primary key.
|
int update()
throws DataException
DataException - exception thrown if the specific data store controls throw an Exception,
such as a JDBC driver.int insert()
throws DataException
DataException - exception thrown if the specific data store controls throw an Exception,
such as a JDBC driver.int delete()
throws DataException
DataException - exception thrown if the specific data store controls throw an Exception,
such as a JDBC driver.T retrieve() throws DataException
Keep in mind that a retrieve expects an instance of the
Object you're retrieving and returning an Object you're retrieving which could only match
on the primary key
DataException - exception thrown if the specific data store controls throw an Exception,
such as a JDBC driver.java.util.List<T> retrieveList(Condition con) throws DataException
Condition. The order would
be the same as defined by the order by clause in the Conditioncon - Condition, the condition to be used to retrieve the collection of data objectsDataException - exception thrown if the specific data store controls throw an Exception,
such as a JDBC driver.Condition