当前位置: 首页 > news >正文

seo网站编辑是做什么的求职网站的建设方案

seo网站编辑是做什么的,求职网站的建设方案,廊坊网站建设墨子,无锡网站设计开发JdbcTemplate概述 它是spring框架中提供的一个对象,是对原始繁琐的JdbcAPI对象的简单封装。spring框架为我们提供了很多的操作模板类。例如:操作关系型数据的JdbcTemplate和MbernateTemplate,操作nosql数据库的RedisTemplate,操作消息队列的…

JdbcTemplate概述

它是spring框架中提供的一个对象,是对原始繁琐的JdbcAPI对象的简单封装。spring框架为我们提供了很多的操作模板类。例如:操作关系型数据的JdbcTemplate和MbernateTemplate,操作nosql数据库的RedisTemplate,操作消息队列的JmsTemplate等等。

JdbcTemplate开发步骤

① 导入spring-jdbc和spring-tx坐标

② 创建数据库表和实体

③ 创建JdbcTemplate对象

④ 执行数据库操作

@Test// 测试JdbcTemplate的开发步骤public void test2() throws PropertyVetoException {ApplicationContext app = new ClassPathXmlApplicationContext("applicationContext.xml");JdbcTemplate jdbcTemplate = app.getBean(JdbcTemplate.class);int row = jdbcTemplate.update("insert into account values(?, ?)", "lisi11", 1000);System.out.println(row);}//-----------------------------------------------------<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:context="http://www.springframework.org/schema/context"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"><!--    加载jdbc.properties--><context:property-placeholder location="classpath:jdbc.properties"/><!--    数据源对象--><bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"><property name="driverClass" value="${jdbc.driver}"/><property name="jdbcUrl" value="${jdbc.url}"/><property name="user" value="${jdbc.username}"/><property name="password" value="${jdbc.password}"/></bean><!--    jdbc模板对象--><bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"><property name="dataSource" ref="dataSource"/></bean></beans>//----------------------------------------------jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/test
jdbc.username=root
jdbc.password=1234

 JdbcTemplate基本使用-常用操作-更新删除操作

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
public class JdbcTemplateCRUDTest {@Autowiredprivate JdbcTemplate jdbcTemplate;@Testpublic void testUpdate(){jdbcTemplate.update("update account set money = ? where name = ?",10001, "wangwu");}@Testpublic void testDelete(){jdbcTemplate.update("delete from account where money = ?", 10001);}
}

 JdbcTemplate基本使用-常用操作-查询操作

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration("classpath:applicationContext.xml")
public class JdbcTemplateCRUDTest {@Autowiredprivate JdbcTemplate jdbcTemplate;@Testpublic void testUpdate(){jdbcTemplate.update("update account set money = ? where name = ?",10001, "wangwu");}@Testpublic void testDelete(){jdbcTemplate.update("delete from account where money = ?", 10001);}//查询多个@Testpublic void estQuery(){List<Account> accountList = jdbcTemplate.query("select * from account", new BeanPropertyRowMapper<Account>(Account.class));System.out.println(accountList);}//查询一个@Testpublic void testQueryOne(){List<Account> accountList = jdbcTemplate.query("select * from account where name=?", new BeanPropertyRowMapper<Account>(Account.class), "lisi");System.out.println(accountList);}//聚合查询@Testpublic void testQueryCount(){Long count = jdbcTemplate.queryForObject("select count(*) from account", Long.class);System.out.println(count);}
}

http://www.dtcms.com/a/433623.html

相关文章:

  • 罗湖网站建设优化wordpress 博客多人
  • 网站icp 备案查询网站建设哪里培训
  • 网站和新媒体建设方案一键下载安装微信
  • 网站模板设计师要求jsp网站开发需要什么技术
  • 建站中企动力网站优化提升排名
  • 网站建设怎么在png上写文字广州微网站建设哪家好
  • 为什么要建设档案网站做零食网站的选题理由
  • 苏州网站建设软件云服务器安装win系统做网站
  • 公司网站如何seo网站开发时浮动框的代码
  • 武威做网站的网站开发公司属于什么行业
  • 免费建自己的网站html5 网站模板
  • 龙岩网站推广营销wordpress上传到服务器
  • 有教做素食的网站吗wordpress如何使用
  • 个人网站名称 备案合肥网站建设
  • 如何搭建 seo网站旺道seo推广效果怎么样
  • 有什么好看的网站资源网页游戏平台系统
  • 邢台网站制作公司更改wordpress前缀
  • wordpress简单易懂的网站河南住房建设部网站
  • 做宠物网站班级网站怎么做
  • 广州口碑好的网站建设设计pc软件开发工具
  • 杭州网站建设响应式高端大气公司名称
  • 淄博网站建设详细策划做分销网站系统下载
  • 做网站设计累吗海口网站建设平台
  • 网站模板服务商阿里云企业邮箱收费标准
  • 贵阳58同城做网站wap网站的好处
  • 有没有一个网站做黄油视频邯郸最近发生的重大新闻
  • 广州知名网站建设公司区块链开发是什么意思
  • 外贸网站模板哪里下载Wordpress税表
  • 开发一个功能网站多少钱付钱做编程题目的网站
  • 石家庄网站app制作外贸家具网站