String SQL="select * from the user where the username=? And password=?" ;
User User=template. QueryForObject (SQL, new BeanPropertyRowMapper
Don't understand BeanPropertyRowMapper
CodePudding user response:
BeanPropertyRowMapperWill you this SQL to check the data according to your rules of the User data model, encapsulated into a User object
So you this queryForObject method return value type is a User
Null pointer problem is that the query returns null may not necessarily the returned result is an empty line (you can as a small bug),
Solution can be: direct try-catch the query if thrown null pointer directly to the user assignment to null
Is whether the query to the empty rows of data or no data, the final result is null
CodePudding user response:
Find out problems, thought is JDBCUtils tools for DateSource assignment problems, when creating the template into the DataSource, lead to the template while creating, but can not connect to the database correctly,CodePudding user response:
I also am null pointer exception difficult oh play on meCodePudding user response:
See if it's all right to connect to the database