<?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"

 xmlns:tx="http://www.springframework.org/schema/tx"

 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/tx

  http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

 <context:property-placeholder location="classpath:jdbc.properties" />

 <context:component-scan base-package="net.roseindia" />

 <tx:annotation-driven transaction-manager="hibernateTransactionManager"

 />

 <bean id="jspViewResolver"

 class="org.springframework.web.servlet.view.InternalResourceViewResolver">

 <property name="viewClass"

 value="org.springframework.web.servlet.view.JstlView"/>

 <property name="prefix" value="/WEB-INF/view/"/>

 <property name="suffix" value=".jsp"/>

 </bean>

 <bean id="dataSource"

 class="org.springframework.jdbc.datasource.DriverManagerDataSource">

 <property name="driverClassName" value="${database.driver}" />

 <property name="url" value="${database.url}" />

 <property name="username" value="${database.user}" />

 <property name="password" value="${database.password}" />

 </bean>

 <bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
<property name="configurationClass">
<value>org.hibernate.cfg.AnnotationConfiguration</value>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
</props>
</property>
</bean>
<!-- <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="annotatedClasses"> <list> <value>net.roseindia.model.Article</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">${hibernate.dialect}</prop> <prop key="hibernate.show_sql">${hibernate.show_sql}</prop> </props> </property> </bean> -->
<bean id="hibernateTransactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> </beans>

hibernate.cfg.xml

 <?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration>
<session-factory>
<mapping class="net.roseindia.model.Article" />
</session-factory>
</hibernate-configuration>

结构

最新文章

  1. conversations.im
  2. word使用笔记(1)
  3. SOA、ESB、NServiceBus、云计算 总结
  4. 谁在关心toString的性能?
  5. a
  6. HttpModule &amp; HttpHandler
  7. vector3.forward和transform.forward的区别!
  8. 正则基础之——环视(Lookaround)
  9. top 介绍
  10. C/C++大数库简介
  11. Repair the database using DBCC CHECKDB
  12. 数据结构【二】:简单阻塞队列BlockingQueue
  13. (转)《深入理解java虚拟机》学习笔记4——Java虚拟机垃圾收集器
  14. Protel99se教程七:创建PCB元件封装
  15. 测试框架:使用SONAR分析代码质量
  16. java三大版本和核心优势
  17. React组件绑定this的三种方法
  18. Mysql数据字典导出
  19. kali自定义分辨率(1920*1080)
  20. tesseract安装及问题处理

热门文章

  1. PHP函数技巧篇
  2. adb shell getprop,setprop,watchprops更改,查看,监听系统属性
  3. Contextual Action bar(3) 两个示例
  4. C# 对象复制
  5. GCC KEIL ARM编译器
  6. solr管理界面下统计多个时间段的数据 facet.query
  7. Java基础学习-一切皆为对象
  8. 自定义 TypeHandler
  9. 6 Specialzed layers 特殊层 第二部分 读书笔记
  10. iOS UI异步更新:dispatch_async 与 dispatch_get_global_queue 的使用方法