queryForObject

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.

Return

an object get from the first row of the ResultSet of this statement, or null of there is no row.

Parameters

connection

a Jdbc Connection

sql

a sql string with named parameters

parametersDto

a data object to set the parameters, or null if the statement doesn't have any parameters

resultType

type of the returned result.