QueryExecutor

class QueryExecutor(val mappingProvider: ClassMappingProvider)

A convenient wrapper to simply the interactions among ClassMappingProvider, NpCallableStatement and MappedResultSet.

Constructors

Link copied to clipboard
fun QueryExecutor(mappingProvider: ClassMappingProvider)

Functions

Link copied to clipboard
fun execute(connection: Connection, sql: String, parametersDto: Any?)
Link copied to clipboard
fun <T : Any> queryForList(connection: Connection, sql: String, parametersDto: Any?, elementType: Class<T>): List<T>

Execute a prepared statement and parse the rows of ResultSet into a list of objects. The statement is closed after this method returns.

Link copied to clipboard
fun <T : Any> queryForObject(connection: Connection, sql: String, parametersDto: Any?, resultType: Class<T>): T?

Execute a prepared statement and get the first row as an object. The statement is closed after this method returns.

Link copied to clipboard
fun <T : Any> queryForScalar(connection: Connection, sql: String, parametersDto: Any?): T?

Get value of the first column of the first row of ResultSet. The statement is closed after this method returns.

Properties

Link copied to clipboard