()-servlet.xml中剥离出的hibernate.cfg.xml
2024-08-23 07:23:43
<?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>
结构
最新文章
- conversations.im
- word使用笔记(1)
- SOA、ESB、NServiceBus、云计算 总结
- 谁在关心toString的性能?
- a
- HttpModule &; HttpHandler
- vector3.forward和transform.forward的区别!
- 正则基础之——环视(Lookaround)
- top 介绍
- C/C++大数库简介
- Repair the database using DBCC CHECKDB
- 数据结构【二】:简单阻塞队列BlockingQueue
- (转)《深入理解java虚拟机》学习笔记4——Java虚拟机垃圾收集器
- Protel99se教程七:创建PCB元件封装
- 测试框架:使用SONAR分析代码质量
- java三大版本和核心优势
- React组件绑定this的三种方法
- Mysql数据字典导出
- kali自定义分辨率(1920*1080)
- tesseract安装及问题处理
热门文章
- PHP函数技巧篇
- adb shell getprop,setprop,watchprops更改,查看,监听系统属性
- Contextual Action bar(3) 两个示例
- C# 对象复制
- GCC KEIL ARM编译器
- solr管理界面下统计多个时间段的数据 facet.query
- Java基础学习-一切皆为对象
- 自定义 TypeHandler
- 6 Specialzed layers 特殊层 第二部分 读书笔记
- iOS UI异步更新:dispatch_async 与 dispatch_get_global_queue 的使用方法