|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.finalist.tools.database.RowMapper com.finalist.tools.database.OracleRowMapper
Implementation of the rowmapper for Oracle. This class has been tested against Oracle 8.1.7 and 8.2.
Constructor Summary | |
OracleRowMapper()
|
Method Summary | |
java.sql.PreparedStatement |
bind(java.sql.PreparedStatement pstmt,
java.lang.Object bindVar,
java.lang.String bindVarClassType,
int pos)
Method that binds an object of a specified type into a PreparedStatement and returns the PreparedStatement. |
static java.util.ArrayList |
convertDatatypes(java.util.ArrayList columnList)
converts datatypes from oracle specific to java specific types. |
java.lang.Object |
unBindIntoBean(java.sql.ResultSet rset,
java.lang.Object target)
Method reads the values from a ResultSet and puts them as properties into a bean. |
java.util.HashMap |
unBindIntoHashMap(java.sql.ResultSet rset,
java.util.HashMap target)
Method reads the values from a ResultSet and puts them as properties into a HashMap. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public OracleRowMapper()
Method Detail |
public java.sql.PreparedStatement bind(java.sql.PreparedStatement pstmt, java.lang.Object bindVar, java.lang.String bindVarClassType, int pos) throws java.sql.SQLException, NotMappableException
Input Type | Method used | NullType used |
String | setString() | java.sql.Types.VARCHAR |
int/Integer | setInt() | java.sql.Types.Numeric |
byte/Byte | setByte() | java.sql.Types.Numeric |
short/Short | setShort() | java.sql.Types.Numeric |
float/Float | setFloat() | java.sql.Types.Numeric |
long/Long | setLong() | java.sql.Types.Numeric |
double/Double | setDouble() | java.sql.Types.Numeric |
util.Date | setDate() | java.sql.Types.Date |
util.Calendar | setDate() | java.sql.Types.Date |
bind
in class RowMapper
pstmt
- PreparedStatement to which the object should be bound.bindVar
- the object that is to be bound.bindVarClassType
- the full classname that identifies the type of the classpos
- the position at which the object should be bound into the statement.
NotMappableException
- when no appropriate bind method could be found
java.sql.SQLException
public java.util.HashMap unBindIntoHashMap(java.sql.ResultSet rset, java.util.HashMap target) throws java.sql.SQLException, NotMappableException
Oracle Datatype | Java Object type |
VARCHAR2 | String |
DATE | java.sql.Timestamp |
NUMBER(<3,0) | Byte |
NUMBER(>2 <6,0) | Short |
NUMBER(>5 <10,0) | Integer |
NUMBER(>9 <19,0) | Long |
NUMBER( (scale and precision)<13) | Float |
NUMBER( (scale and precision)>12) | Double |
CHAR | String |
Date | java.util.Date |
unBindIntoHashMap
in class RowMapper
rset
- ResultSettarget
- The HashMap in which the values are stored
java.sql.SQLException
- thrown when some SQL related error occurs.
NotMappableException
- thrown when no appropriate mapping could be found to map
a SQL datatype to a Java counterpart.public java.lang.Object unBindIntoBean(java.sql.ResultSet rset, java.lang.Object target) throws java.sql.SQLException, NotMappableException
unBindIntoBean
in class RowMapper
rset
- ResultSettarget
- The bean whose properties should be set.
java.sql.SQLException
- thrown when some SQL related error occurs.
NotMappableException
- thrown when no appropriate mapping could be found to map
a SQL datatype to a Java counterpart.public static java.util.ArrayList convertDatatypes(java.util.ArrayList columnList)
columnList
- ArrayList filled with hashMaps. HashMap consists of name, type, scale and precision.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |