queryForList

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.

Return

a collection of objects parsed from ResultSet

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

elementType

the element type of the returned collection