Advertisement
Guest User

Untitled

a guest
May 15th, 2016
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.03 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"
  4.  xmlns:context="http://www.springframework.org/schema/context"
  5.  xmlns:tx="http://www.springframework.org/schema/tx"
  6.  xmlns:p="http://www.springframework.org/schema/p"
  7.  xsi:schemaLocation="http://www.springframework.org/schema/beans
  8.    http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  9.    http://www.springframework.org/schema/context
  10.    http://www.springframework.org/schema/context/spring-context-3.0.xsd
  11.    http://www.springframework.org/schema/tx
  12.    http://www.springframework.org/schema/tx/spring-tx.xsd">
  13.  
  14.   <tx:annotation-driven transaction-manager="transactionManager"/>
  15.  
  16.   <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
  17.    destroy-method="close">
  18.     <property name="driverClassName" value="org.postgresql.Driver" />
  19.     <property name="url" value="jdbc:postgresql://127.0.0.1:5432/test" />
  20.     <property name="username" value="postgres" />
  21.     <property name="password" value="postgress" />
  22.   </bean>
  23.  
  24.   <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
  25.     <property name="dataSource" ref="dataSource"></property>
  26.     <property name="annotatedClasses">
  27.     <list>
  28.     <value>org.entity.nci.person.Person</value>
  29.     </list>
  30.     </property>
  31.     <property name="hibernateProperties">
  32.       <props>
  33.         <prop
  34.         key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
  35.         <prop key="hibernate.show_sql">true</prop>
  36.       </props>
  37.     </property>
  38.     <property name="packagesToScan" value="com.byteslounge.spring.tx.model" />
  39.   </bean>
  40.  
  41.   <bean id="transactionManager"
  42.    class="org.springframework.orm.hibernate4.HibernateTransactionManager"
  43.    p:sessionFactory-ref="sessionFactory">
  44.   </bean>
  45.   <tx:advice id="transactionAdvice" transaction-manager="transactionManager">  
  46.   <tx:attributes>    
  47.     <tx:method name="*"/>
  48.   </tx:attributes>
  49.   </tx:advice>
  50.  
  51. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement