org.brains2b.data
Interface DataControl
- All Known Implementing Classes:
- OracleDC, SqlDC
public interface DataControl
Interface DataControl
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 mechanisme 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
- Version:
- 0.20 [16-01-2007]
- Author:
- dennis@brains2b.nl
Method Summary |
int |
delete()
Delete the data object from the datatore on primary key. |
int |
insert()
insert a data object |
java.lang.Object |
retrieve()
retrieve a data object on the basis of the primary key contained in Object o |
java.util.List |
retrieveList(Condition con)
retrieve all records meeting the values set in Condition . |
int |
update()
Update the data object on primary key. |
update
int update()
throws DataException
- Update the data object on primary key.
- Returns:
- int, the number of records updated, should alwyas return one
- Throws:
DataException,
- exception thrown if the specific data store controls throw an Exception,
such as a JDBC driver.
DataException
insert
int insert()
throws DataException
- insert a data object
- Returns:
- int, the number or records updated, should always return one
- Throws:
DataException,
- exception thrown if the specific data store controls throw an Exception,
such as a JDBC driver.
DataException
delete
int delete()
throws DataException
- Delete the data object from the datatore on primary key.
- Returns:
- int, the number or records deleted, should always return one
- Throws:
DataException,
- exception thrown if the specific data store controls throw an Exception,
such as a JDBC driver.
DataException
retrieve
java.lang.Object retrieve()
throws DataException
- retrieve a data object on the basis of the primary key contained in Object o
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
- Returns:
- Object, the data object which is retrieved from the primary key.
- Throws:
DataException,
- exception thrown if the specific data store controls throw an Exception,
such as a JDBC driver.
DataException
retrieveList
java.util.List retrieveList(Condition con)
throws DataException
- retrieve all records meeting the values set in
Condition
. The order would
be the same as defined by the order by clause in the Condition
- Parameters:
con
- Condition, the condition to be used to retrieve the collection of data objects
- Returns:
- Vector, a collection of data objects
- Throws:
DataException,
- exception thrown if the specific data store controls throw an Exception,
such as a JDBC driver.
DataException
- See Also:
Condition