首页 新闻 搜索 专区 学院

关于修改hibernate配置。将oracle数据库改成mysql如何修改

0
[待解决问题]

<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
<!-- 数据库连接 -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://localhost:3306/LogManagement?characterEncoding=utf-8" />
<property name="username" value="root" />
<property name="password" value="123456" />
<property name="maxActive" value="100" />
</bean>
<!-- Hibernate Properties -->
<bean id="hibernateProperties"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.format_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
</props>
</property>
</bean>
<!--配置SessionFactory -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="lobHandler" ref="oracleLobHandler" />
<property name="hibernateProperties" ref="hibernateProperties" />
<property name="annotatedClasses" ref="annotatedClasses" />
</bean>
<!-- annotation 类 -->
<bean id="annotatedClasses"
class="org.springframework.beans.factory.config.ListFactoryBean">
<property name="sourceList">
<list>
<value>lms.code.beans.LMS_Logs</value>
<value>lms.code.beans.LMS_Projects</value>
<value>lms.code.beans.LMS_Roles</value>
<value>lms.code.beans.LMS_Sections</value>
<value>lms.code.beans.LMS_Staffs</value>
<value>lms.code.beans.LMS_WorkReports</value>
<value>lms.code.beans.LMS_Tasks</value>
</list>
</property>
</bean>
<!-- 使用spring+hibernate处理oracle BLOB -->
<bean id="nativeJdbcExtractor" lazy-init="true"
class="org.springframework.jdbc.support.nativejdbc.SimpleNativeJdbcExtractor" />
<bean id="oracleLobHandler" class="org.springframework.jdbc.support.lob.DefaultLobHandler"
lazy-init="true">
</bean>
</beans>

软工小盆友的主页 软工小盆友 | 菜鸟二级 | 园豆:208
提问于:2018-04-13 15:56
< >
分享
所有回答(1)
0
ycyzharry | 园豆:24312 (高人七级) | 2018-04-13 16:04

能不能帮忙直接给我改一下呢

支持(0) 反对(0) 软工小盆友 | 园豆:208 (菜鸟二级) | 2018-04-18 12:46
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册