Home > Back-end > Based on the Druid connection pool JdbcTemplate. QueryForObject always returns an empty object
Based on the Druid connection pool JdbcTemplate. QueryForObject always returns an empty object
Time:04-05
. Using a Druid connection pool JdbcTemplate queryForObject method for database query, using BeanPropertyRowMapper () object encapsulation return whether an object query right and wrong, Java always returns null object methods are tried of the troubled for a long time online are not solve Abnormal servlet. Http will quote The third is the source of the problem Javabean using are the basic data types that can discharge The database column names consistent with the object name Hope someone can help me with the
CodePudding user response:
QueryForObject this approach is that if your database through your SQL queries to check out the data, the exception will be thrown, means the method itself is expected to have a result, but you didn't find out the results, so you change queryForList, or directly try to catch is also done