T
- a type to map an SQL query result topublic abstract class SingleResultMapper<T>
extends java.lang.Object
Constructor and Description |
---|
SingleResultMapper() |
Modifier and Type | Method and Description |
---|---|
protected void |
addToResults(T entity)
Adds an entity to results list.
|
protected java.math.BigDecimal |
getBigDecimal(java.lang.String column)
Gets a big decimal value of the specified column from the result set.
|
protected java.lang.Boolean |
getBoolean(java.lang.String column)
Gets a boolean value of the specified column from the result set.
|
protected java.util.Date |
getDate(java.lang.String column)
Gets a date value of the specified column from the result set.
|
protected java.lang.Double |
getDouble(java.lang.String column)
Gets a double value of the specified column from the result set.
|
protected java.lang.Integer |
getInteger(java.lang.String column)
Gets an integer value of the specified column from the result set.
|
protected java.lang.Long |
getLong(java.lang.String column)
Gets a long value of the specified column from the result set.
|
protected java.lang.Object |
getObject(java.lang.String column)
Gets an object value of the specified column from the result set.
|
protected java.util.List<T> |
getResults()
Gets the current results list.
|
protected java.sql.ResultSet |
getResultSet()
Gets the
java.sql.ResultSet with a cursor set to row that is
currently being processed. |
protected java.lang.String |
getString(java.lang.String column)
Gets a string value of the specified column from the result set.
|
protected java.sql.Timestamp |
getTimestamp(java.lang.String column)
Gets a timestamp value of the specified column from the result set.
|
protected boolean |
isNotNull(java.lang.String column)
Checks if the specified column value from the result set is not null.
|
protected boolean |
isNull(java.lang.String column)
Checks if the specified column value from the result set is null.
|
protected abstract void |
mapRow()
Maps a current row from result set to the results list.
|
protected <E> E |
merge(E entity,
java.util.List<E> entities)
Adds an entity to entities list if it is not already added.
|
protected T |
mergeWithResults(T entity)
Adds an entity to results list if it is not already added.
|
protected final T mergeWithResults(T entity)
equals
and
hashCode
methods.entity
- entity to merge with results listprotected final void addToResults(T entity)
entity
- entity to addprotected final java.util.List<T> getResults()
protected abstract void mapRow() throws java.sql.SQLException
java.sql.SQLException
- if a database access error occursprotected final <E> E merge(E entity, java.util.List<E> entities)
equals
and
hashCode
methods.E
- an entity typeentity
- entity to merge with entities listentities
- list of entitiesprotected final java.sql.ResultSet getResultSet()
java.sql.ResultSet
with a cursor set to row that is
currently being processed.protected final boolean isNull(java.lang.String column) throws java.sql.SQLException
column
- result set column nametrue
if value is null, otherwise false
java.sql.SQLException
- if the column name is not valid; if a database
access error occurs or this method is called on a closed result setprotected final boolean isNotNull(java.lang.String column) throws java.sql.SQLException
column
- result set column nametrue
if value is not null, otherwise false
java.sql.SQLException
- if the column name is not valid; if a database
access error occurs or this method is called on a closed result setprotected final java.lang.Integer getInteger(java.lang.String column) throws java.sql.SQLException
column
- result set column namejava.sql.SQLException
- if the column name is not valid; if a database
access error occurs or this method is called on a closed result setprotected final java.lang.String getString(java.lang.String column) throws java.sql.SQLException
column
- result set column namejava.sql.SQLException
- if the column name is not valid; if a database
access error occurs or this method is called on a closed result setprotected final java.lang.Object getObject(java.lang.String column) throws java.sql.SQLException
column
- result set column namejava.sql.SQLException
- if the column name is not valid; if a database
access error occurs or this method is called on a closed result setprotected final java.util.Date getDate(java.lang.String column) throws java.sql.SQLException
column
- result set column namejava.sql.SQLException
- if the column name is not valid; if a database
access error occurs or this method is called on a closed result setprotected final java.lang.Double getDouble(java.lang.String column) throws java.sql.SQLException
column
- result set column namejava.sql.SQLException
- if the column name is not valid; if a database
access error occurs or this method is called on a closed result setprotected final java.lang.Boolean getBoolean(java.lang.String column) throws java.sql.SQLException
column
- result set column namejava.sql.SQLException
- if the column name is not valid; if a database
access error occurs or this method is called on a closed result setprotected final java.math.BigDecimal getBigDecimal(java.lang.String column) throws java.sql.SQLException
column
- result set column namejava.sql.SQLException
- if the column name is not valid; if a database
access error occurs or this method is called on a closed result setprotected final java.lang.Long getLong(java.lang.String column) throws java.sql.SQLException
column
- result set column namejava.sql.SQLException
- if the column name is not valid; if a database
access error occurs or this method is called on a closed result setprotected final java.sql.Timestamp getTimestamp(java.lang.String column) throws java.sql.SQLException
column
- result set column namejava.sql.SQLException
- if the column name is not valid; if a database
access error occurs or this method is called on a closed result set