Spring配置数据源以及hibernate
<?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:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.1.xsd"
xmlns:tx="http://www.springframework.org/schema/tx"> <bean id="datasource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/flower??useUnicode=true&characterEncoding=UTF-8"></property>
<property name="username" value="root" />
<property name="password" value="" />
<!-- 数据库连接池保持的最小连接数 -->
<property name="minIdle" value="" /> <property name="maxIdle" value="" />
<property name="testOnBorrow" value="true" />
<!-- 返回连接时是否进行有效性验证 -->
<property name="testOnReturn" value="true" />
<!-- 连接空闲时是否进行有效性验证 -->
<property name="testWhileIdle" value="true" />
</bean> <bean id="sessionFactory"
class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="datasource"/>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>com/jikexueyuan/entity/Assess.hbm.xml</value>
<value>com/jikexueyuan/entity/Catalog.hbm.xml</value>
<value>com/jikexueyuan/entity/ConsumeDetaileInfo.hbm.xml</value>
<value>com/jikexueyuan/entity/ConsumeOrder.hbm.xml</value>
<value>com/jikexueyuan/entity/Flower.hbm.xml</value>
<value>com/jikexueyuan/entity/OrderForm.hbm.xml</value>
<value>com/jikexueyuan/entity/ShoppingCart.hbm.xml</value>
<value>com/jikexueyuan/entity/User.hbm.xml</value>
<value>com/jikexueyuan/entity/UserDetail.hbm.xml</value>
</list>
</property>
</bean>
</beans>
Spring配置数据源以及hibernate的更多相关文章
- 【Java Web开发学习】Spring配置数据源
Spring配置数据源 转载:https://www.cnblogs.com/yangchongxing/p/10027495.html =============================== ...
- Spring配置数据源
Spring在第三方依赖包中包含了两个数据源的实现类包,其一是Apache的DBCP,其二是 C3P0.可以在Spring配置文件中利用这两者中任何一个配置数据源. DBCP数据源 DBCP类包位于 ...
- Spring 配置数据源
配置一个数据源 Spring在第三方依赖包中包含了两个数据源的实现类包,其一是Apache的DBCP,其二是 C3P0.可以在Spring配置文件中利用这两者中任何一个配置数据源. DBCP数 ...
- Spring配置数据源的几种方法
一:数据源的配置1.通过JNDI配置数据源 1.在tomcat context.xml中配置数据源 <Resource name="jdbc/ds" au ...
- Spring 配置数据源之一三兄弟
前期的准备工作,我们是使用的是maven,我们下载节点即可... 节点如下: <dependency> <groupId>org.springframework</gro ...
- Spring配置数据源的三种方法
前言:今天接触新项目发现用的是JNDI配置数据源,用度娘倒腾了一会也没弄好,只好用平常用的方法,结果发现BasicDataSource和DriverManagerDataSource也是不同的,所以记 ...
- Spring配置数据源的几种形式
Spring中提供了4种不同形式的数据源配置方式: 1.Spring自带的数据源(DriverMangerDataSource); 2.DBCP数据源; 3.C3P0数据源; 4.JNDI数据源. 以 ...
- 使用Spring配置数据源JdbcTemplate
c3p0作为演示 1.编写资源文件(db.properties) jdbc.user=root jdbc.password=root jdbc.jdbcUrl=jdbc:mysql://localho ...
- 【Spring】19、spring配置数据源的4种方式
不管采用何种持久化技术,都需要定义数据源.Spring中提供了4种不同形式的数据源配置方式: spring自带的数据源(DriverManagerDataSource),DBCP数据源,C3P0数据源 ...
随机推荐
- Java基础 -2.4
字符型char类型 在任何的编程语言之中,字符都可以与int进行互相转换,也就是这个字符中所描述的内容可以通过int获取其内容所在的系统编码 public class ddd { public sta ...
- UniGUI的SQLite数据库(04)
1]放FDConnection1和FDQuery1到界面上 一定要 放一个 FDPhysSQLiteDriverLink1到ServerModule上 2]在OnFormCreate事件里写 FDQ ...
- 获取SDWebImage的缓存大小并清除
// 获取SDWebImage的缓存大小 - (NSString *)cacheSizeFormat { NSString *sizeUnitString; float size = [SDWebIm ...
- 2020.2.19 restful的学习
restful Api 设计要素 3-8 如何设计Restful Api 资源路径(url),HTTP动词,过滤信息(做分页),状态码,错误处理,返回结果 3-9 初始化运行参数 3-10 ...
- nginx反向代理(2)
目录 nginx缓存 基本概念 常用模块 proxy_cache 超时相关 常见架构 ========================================================= ...
- 吴裕雄 Bootstrap 前端框架开发——Bootstrap 辅助类:表格单元格使用了 "bg-danger" 类
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title> ...
- 使用anaconda 3安装tensorflow 1.15.0 (win10环境)
0.写在前面 之前其实安装过一次tensorflow,但是由于电脑中毒,重装了系统,把所有的环境全部删除了.之前在博客里转发了一篇别人在win10安装tensorflow的教程,但是版本比较旧了, ...
- 线程context
线程切换的时候,要保存当前运行状态,以便后续切换回来 CONTEXT结构体保存的是一堆寄存器 两个函数 //You cannot get a valid context for a running t ...
- oracle数据库时间是毫秒值,创建function,直接SQL取值。
首先创建一个function: create or replace function num_to_date(in_number NUMBER) return date is begin return ...
- Link Analysis_1_Basic Elements
1. Edge Attributes 1.1 Methods of category 1.1.1 Basic three categories in terms of number of layers ...