rrader
12/04/2018, 9:32 AMinline fun <reified T : Any?> NamedParameterJdbcTemplate.queryForObject(sql: String, parameters: Map<String, *>): T {
if (null is T) {
return try {
this.queryForObject(sql, parameters, T::class.java) as T
} catch (ex: EmptyResultDataAccessException) {
return null
}
} else {
return this.queryForObject(sql, parameters, T::class.java) as T
}
}
so return null
is not possible, but if we call queryForObject<Long?>
it should allow null