https://kotlinlang.org logo
#announcements
Title
# announcements
r

rrader

12/04/2018, 9:32 AM
well, it works but is it possible to fix this
Copy code
inline 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