TYPE - The Java type represented by the column.public class GenericColumn<TYPE> extends Object
This can be used if none of the types Hrorm has built in meet
the needs. The user must provide mechanisms for setting the
type's value onto a java.sql.PreparedStatement and
for reading a value from a java.sql.ResultSet.
For example, to create a column for Integer, do the following:
GenericColumn<Integer> integerColumn = new GenericColumn<>(
PreparedStatement::setInt,
ResultSet::getInt,
java.sql.Types.Integer);
| Constructor and Description |
|---|
GenericColumn(org.hrorm.PreparedStatementSetter<TYPE> preparedStatementSetter,
ResultSetReader<TYPE> resultReader,
int sqlType)
Create a generic column instance to support the
TYPE. |
GenericColumn(org.hrorm.PreparedStatementSetter<TYPE> preparedStatementSetter,
ResultSetReader<TYPE> resultReader,
int sqlType,
String sqlTypeName)
Create a generic column instance to support the
TYPE. |
| Modifier and Type | Method and Description |
|---|---|
TYPE |
fromResultSet(ResultSet resultSet,
String columnName) |
String |
getSqlTypeName() |
void |
setPreparedStatement(PreparedStatement preparedStatement,
int index,
TYPE value) |
int |
sqlType() |
public GenericColumn(org.hrorm.PreparedStatementSetter<TYPE> preparedStatementSetter, ResultSetReader<TYPE> resultReader, int sqlType)
TYPE.preparedStatementSetter - The method used to set the type onto a prepared statement.resultReader - The method used to read the value out of a result set.sqlType - The kind of this column type, as defined in java.sql.Typespublic GenericColumn(org.hrorm.PreparedStatementSetter<TYPE> preparedStatementSetter, ResultSetReader<TYPE> resultReader, int sqlType, String sqlTypeName)
TYPE.preparedStatementSetter - The method used to set the type onto a prepared statement.resultReader - The method used to read the value out of a result set.sqlType - The kind of this column type, as defined in java.sql.TypessqlTypeName - The name of the type in the SQL schema. This optional value can be set
if you wish to generate your schema using a Schema object.public TYPE fromResultSet(ResultSet resultSet, String columnName) throws SQLException
SQLExceptionpublic void setPreparedStatement(PreparedStatement preparedStatement, int index, TYPE value) throws SQLException
SQLExceptionpublic int sqlType()
public String getSqlTypeName()
Copyright © 2019. All rights reserved.