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

CodePudding user response:

reference 1/f, thin black camel died response:
queryForObject this approach is that if your database through your SQL queries to check out the data, the exception will be thrown, which means the method itself is expected to have a result, but you didn't find out the results, so you have to do is change queryForList, or directly try catch also done
I used list now find the root cause is the front desk to get the value of the puzzling when passed to the code has been resolved

CodePudding user response:

Bosses, you are how to solve of, I also met the same problem, the normal query result of the name attribute of the object returned is null
  • Related