Advertisement
Guest User

Untitled

a guest
Jan 15th, 2017
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.47 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:tx="http://www.springframework.org/schema/tx"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd">
  6.  
  7. <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
  8. destroy-method="close">
  9. <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
  10. <property name="url" value="jdbc:mysql://localhost:3306/test?characterEncoding=utf8"/>
  11. <property name="username" value="root"/>
  12. <property name="password" value=""/>
  13. </bean>
  14.  
  15. <tx:annotation-driven transaction-manager="txManager" proxy-target-class="true"/>
  16. <bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
  17. <property name="dataSource" ref="dataSource"/>
  18. <property name="packagesToScan" value="by.boiko.crm.model"/>
  19. <property name="annotatedClasses">
  20. <list>
  21. <value>by.boiko.crm.model.User</value>
  22. </list>
  23. </property>
  24.  
  25. <property name="hibernateProperties">
  26. <props>
  27. <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
  28. <prop key="hibernate.show_sql">true</prop>
  29. <prop key="hibernate.hbm2ddl.auto">update</prop>
  30. <prop key="current_session_context_class">thread</prop>
  31. <prop key="hibernate.c3p0.min_size">5</prop>
  32. <prop key="hibernate.c3p0.max_size">20</prop>
  33. <prop key="hibernate.c3p0.timeout">300</prop>
  34. <prop key="hibernate.c3p0.max_statements">50</prop>
  35. <prop key="hibernate.c3p0.idle_test_period">3000</prop>
  36. </props>
  37. </property>
  38. </bean>
  39. <bean id="txManager"
  40. class="org.springframework.orm.hibernate5.HibernateTransactionManager">
  41. <property name="sessionFactory" ref="sessionFactory"/>
  42. </bean>
  43. <bean class="org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor"/>
  44. <bean id="persistenceExceptionTranslationPostProcessor"
  45. class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
  46.  
  47. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement