与天地兮比寿,与日月兮齐光。这篇文章主要讲述关于数据库查询new BeanPropertyRowMapper相关的知识,希望能为你提供帮助。
//bean类必须有无参构造,不然new BeanPropertyRowMapper< bean> (bean.class)不会把数据转为bean对象
@Test public voidtest3() throws PropertyVetoException { //List< bean> query = jdbcTemplate.query("select * from jiang", new BeanPropertyRowMapper< > (bean.class)); List< bean> query = jdbcTemplate.query("select * from jiang",new BeanPropertyRowMapper< bean> (bean.class)); System.out.println(query); }
package com.jiang; public class bean { private String username; private String password; public bean() { }public bean(String username, String password) { this.username = username; this.password = password; }public String getUsername() { return username; }public void setUsername(String username) { this.username = username; }public String getPassword() { return password; }public void setPassword(String password) { this.password = password; }@Override public String toString() { return "bean{" + "username=‘" + username + ‘‘‘ + ", password=‘" + password + ‘‘‘ + ‘}‘; } }
【关于数据库查询new BeanPropertyRowMapper】
推荐阅读
- Android.mk编译Helloworld
- ValueError: must have exactly one of create/read/write/append mode
- ReactNative+TypeScript仿喜马拉雅开发App
- 实战企业级项目 践行App重构之路
- uni-app 快速入门 从零开始实现新闻资讯类跨端应用
- @MapperScan注解
- 用TabLayout+ViewPager+Fragment控件实现简单的翻页效果--Android--
- 新增访客数量MR统计之NewInstallUserMapper相关准备
- RN 与 Native (Android) 之间的通信