JDBC_Template (simplified code)

. 1  / ** 
2  * @Description: the TODO (described herein sentence action of this class)
 . 3  * @author aikang
 . 4  * @date 2019/8/27 11:03
 . 5   * / 
. 6  / * 
. 7  the Spring the JDBC:
 . 8      the Spring team JDBC simple package frame provides a simplified JDBCTemplate target JDBC development
 9  steps:
 10      1. import jar package 5
 11      2. Create JDBCTemplate objects, dependent on the data source the dataSource
 12 is          JDBCTemplate the JdbcTemplate new new Template = (DS);
 13 is      3. call JdbcTemplate way to do CRUD operations
 14          Update (): DML statement is executed, additions and deletions
 15          queryForMap (): query results the results are set packaged as a set of map
 16          the queryForList (): the query result is the result set list set package
. 17          Query (SQL, the RowMapper Interface): the query results, the result is a JavaBean package
 18              common implementation class (new new BeanPropertyRowMapper <Emp> (emp.class)),
 . 19  
20 is          queryForObject (SQL, .class result type): the query results, the results are encapsulated as the object
 21 is      the JdbcTemplate Getting Started:
 22          1. import jar package
 23          2. Create an object JDBCTemplate
 24                  own tools
 25              the JdbcTemplate the JdbcTemplate new new Template = (JDBCUtils.getDataSource ());
 26 is          // method call. 3.
 27              updates method
 28              template.update (String SQL, SQL positions correspond to the query parameters)
 29  
30  
31 is   * /

 

Guess you like

Origin www.cnblogs.com/aikang525/p/11417537.html