Private=new JdbcTemplate JdbcTemplate JDBC (DruidUtil getDataSource ()); Public List The.findall () { //TODO Auto - generated method stub
String SQL="select * from user1"; List The users=JDBC query (SQL, new BeanPropertyRowMapper (Login. Class)); return users; }
}
Domain code: Public class Login {
private String name; private String password; Public String getName () { return name; } Public void elegantly-named setName (String name) { this.name=name; } Public String getPassword () { Return the password; } Public void setPassword (String password) { this.password=password; }
}
Results query out is this: [jdbctest. Login @ 1 b84aa37 jdbctest. Login @ 560 f9a1b jdbctest. Login @ 79 e7f97e] I don't know is what thing,
Query out the right should be like this: [Login [name=zhangsan, password=123], the Login [name=zhang SAN, password=123], the Login [name=lisi, password=123]]
CodePudding user response:
Please bosses to help have a look at it, really desperate, I don't know why
CodePudding user response:
In fact you have found out, just you output is the object's memory address Want to be the format you want to rewrite the Login toString method