Advertisement
Guest User

Untitled

a guest
Oct 17th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 1.97 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3.       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
  4.       xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc"
  5.       xsi:schemaLocation="
  6.         http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
  7.         http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
  8.         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
  9.         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">
  10.  
  11.     <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
  12.         <property name="dataSource" ref="dataSource"/>
  13.         <property name="packagesToScan" value="com.company.shop.dao.entity"/>
  14.         <property name="hibernateProperties">
  15.             <props>
  16.                 <prop key="hibernate.dialect">org.hibernate.dialect.H2Dialect</prop>
  17.                 <prop key="hibernate.show_sql">true</prop>
  18.             </props>
  19.         </property>
  20.     </bean>
  21.  
  22.     <bean id="dataSource" class="org.springframework.jdbc.datasource.SingleConnectionDataSource">
  23.         <property name="driverClassName" value="org.h2.Driver"></property>
  24.         <property name="url" value="jdbc:h2:~/myH2test"></property>
  25.         <property name="username" value="ss"/>
  26.         <property name="password" value=""/>
  27.         <property name="suppressClose" value="true"/>
  28.     </bean>
  29.  
  30.     <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
  31.         <property name="sessionFactory" ref="sessionFactory"/>
  32.     </bean>
  33.  
  34.     <tx:annotation-driven/>
  35.  
  36.     <context:component-scan base-package="com.company.shop" />
  37.  
  38.  
  39. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement