Spring JdbcTemplate Query using

Source: Internet
Author: User
1. Querying a row of data and returning an int type result
jdbcTemplate.queryForInt("select count(*) from test");  
2. Query a row of data and convert the row data to a map return
jdbcTemplate.queryForMap("select * from test where name=‘name5‘");  
3. Query a row for any type of data, and the last parameter specifies the type of return result
jdbcTemplate.queryForObject("select count(*) from test", Integer.class);  
4. Query a batch of data, by default convert each row of data to map
jdbcTemplate.queryForList("select * from test");  
5. Query only one column of data list, column type is string, column name is name
jdbcTemplate.queryForList("select name from test where name=?", new Object[]{"name5"}, String.class);  
6. Query a batch of data, returned as SqlRowSet, similar to resultset, but no longer bound to the connection
SqlRowSet rs = jdbcTemplate.queryForRowSet("select * from test");  

Spring JdbcTemplate Query using

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.