org.brains2b.data.sql
Class SqlDC
java.lang.Object
org.brains2b.data.sql.SqlDC
- All Implemented Interfaces:
- DataControl
- Direct Known Subclasses:
- OracleDC
public abstract class SqlDC
- extends java.lang.Object
- implements DataControl
Abstract class for SqlDataControl objects.
Implements the Object to hold, the Connection and the PreparedStatement to use
but propagates all methods of the DataControl interface for concrete implementation
Adds an additional protected abstract method getObject(ResultSet)
as a standardized
method to create a data Object from a given ResultSet
- Version:
- 0.11 [22-01-2008]
- Author:
- dennis@brains2b.nl
- See Also:
DataControl
Field Summary |
protected java.sql.Connection |
m_con
|
protected java.lang.Object |
m_obj
|
protected java.sql.PreparedStatement |
m_prep
|
Constructor Summary |
SqlDC(java.sql.Connection con,
java.lang.Object o)
Constructor for OracleDC which sets the Connection
to use for this DataControl and the Object on which it should
operate. |
Method Summary |
protected abstract java.lang.Object |
getObject(java.sql.ResultSet rs)
Method getObject returns an instance of the Object this
DataControl was intended to service by reading out the resultset
and filling the methods of the object with the values of the individual fields |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m_obj
protected java.lang.Object m_obj
m_con
protected java.sql.Connection m_con
m_prep
protected java.sql.PreparedStatement m_prep
SqlDC
public SqlDC(java.sql.Connection con,
java.lang.Object o)
- Constructor for OracleDC which sets the Connection
to use for this DataControl and the Object on which it should
operate.
- Parameters:
con
- Connection, the JDBC connection to useo
- Object, the Object for which this DataControl exists.
getObject
protected abstract java.lang.Object getObject(java.sql.ResultSet rs)
throws java.sql.SQLException
- Method getObject returns an instance of the Object this
DataControl was intended to service by reading out the resultset
and filling the methods of the object with the values of the individual fields
This function needs to be implemented to match the specific class definition
of the return Object.
- Parameters:
rs
- ResultSet, Actually a specific position in the ResultSet representing
a row in the table to be mapped to an instance of the Object
- Returns:
- Object, an instance of the Object with all it's particular members filled
from the ResultSet row given through the parameter.
- Throws:
Exception,
- if a SqlException occures.
java.sql.SQLException