Spring3.1.1 + hibernate3.6.8 整合XML配置
来源:互联网 发布:数据库设计基本原则 编辑:程序博客网 时间:2024/05/29 19:44
需要引入的 jar 包就不一一提了,需要哪个就引哪一个吧。
这篇文章的内容是主要是介绍XML文件的配置
xml文件:
<?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:aop="http://www.springframework.org/schema/aop" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"> <context:annotation-config /><context:component-scan base-package="com.bjsxt" /> <context:property-placeholder location="classpath:jdbc.properties" ignore-unresolvable="true"/><bean id="dataSource" destroy-method="close"class="org.apache.commons.dbcp.BasicDataSource"><property name="driverClassName"value="${jdbc.driverClassName}" /><property name="url" value="${jdbc.url}" /><property name="username" value="${jdbc.username}" /><property name="password" value="${jdbc.password}" /></bean><bean id="sessionFactory"class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"><property name="dataSource" ref="dataSource" /><property name="annotatedClasses"><list><value>com.bjsxt.model.User</value></list></property><property name="hibernateProperties"><props><prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop><prop key="hibernate.show_sql">true</prop></props></property></bean></beans>
properties文件:jdbc.properties
jdbc.driverClassName=com.mysql.jdbc.Driverjdbc.url=jdbc:mysql://localhost:3306/springjdbc.username=rootjdbc.password=root
实体类:User.java
package com.bjsxt.model;import javax.persistence.Entity;import javax.persistence.GeneratedValue;import javax.persistence.Id;@Entitypublic class User {private int id;private String name;@Id@GeneratedValuepublic int getId() {return id;}public void setId(int id) {this.id = id;}public String getName() {return name;}public void setName(String name) {this.name = name;}}
- Spring3.1.1 + hibernate3.6.8 整合XML配置
- spring3.1+hibernate3.6.5整合xml
- struts2+Spring3+hibernate3.3整合配置
- struts2+Spring3+hibernate3.3整合配置
- struts2 spring3 hibernate3整合
- Struts2+Spring3+Hibernate3整合
- Struts2+Hibernate3+Spring3 整合
- Struts2+Spring3+Hibernate3整合
- spring3 struts2 hibernate3整合
- ssh最新整合配置(struts2.2.1+ hibernate3.6+spring3.0.5)
- ssh整合配置(struts2.2.1+ hibernate3.6+spring3.0.5)
- struts2.1.8+Spring3.0+Hibernate3.3整合+Hibernate二级缓存配置
- Spring3.0、Hibernate3.0、Struts2整合文件配置
- ssh整合配置(struts2.2.1+ hibernate3.6+spring3.0.5)
- Struts2+Spring3+hibernate3配置
- struts2+spring3+hibernate3整合步骤
- struts2+hibernate3+spring3整合步骤
- Struts2-Spring3-Hibernate3整合开发
- Privilege Management in Web Application
- 怎样在xcode里面使用Memory Leaks和Instruments教程
- 网站开发流程-WEB开发的流程
- 在Objective-c里面使用property教程
- 变量运算符练习 Test
- Spring3.1.1 + hibernate3.6.8 整合XML配置
- 又谈“装系统”
- 函数式语言特点之-单子
- Objective-c的@property 详解
- linux console 使用
- 变量运算符练习Test1
- Java类之间的关联关系
- c++ 实现策略模式
- 测试题(星号版)自己完成的答案(1-12)