hibernate注解扫描配置

xiaoxiao2021-02-28  85

<?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-3.0.xsd">    <bean name="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">   <property name="sessionFactory">    <ref bean="sessionFactory"/>   </property>  </bean>    <bean name="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">   <property name="dataSource" ref="dataSource" />   <property name="configurationClass"  value="org.hibernate.cfg.AnnotationConfiguration">           </property>   <property name="hibernateProperties">    <props>     <prop key="hibernate.show_sql">true</prop>     <prop key="hibernate.hbm2ddl.auto">update</prop>     <prop key="hibernate.connection.autocommit">false</prop>     <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>    </props>   </property>   <property name="packagesToScan">    <list>     <value>实体类包</value>     </list>   </property>  </bean>    <bean name="dataSource" class="org.apache.commons.dbcp.BasicDataSource">   <property name="driverClassName">    <value>com.microsoft.sqlserver.jdbc.SQLServerDriver</value>   </property>   <property name="url">    <value>url</value>   </property>   <property name="username" value="**" />   <property name="password" value="**" />  </bean>   </beans>
转载请注明原文地址: https://www.6miu.com/read-63417.html

最新回复(0)