Advertisement
Guest User

Untitled

a guest
Apr 11th, 2016
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.32 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:mvc="http://www.springframework.org/schema/mvc"
  5. xmlns:jdbc="http://www.springframework.org/schema/jdbc"
  6. xmlns:context="http://www.springframework.org/schema/context"
  7. xsi:schemaLocation="http://www.springframework.org/schema/beans
  8. http://www.springframework.org/schema/beans/spring-beans.xsd
  9. http://www.springframework.org/schema/mvc
  10. http://www.springframework.org/schema/mvc/spring-mvc.xsd
  11. http://www.springframework.org/schema/context
  12. http://www.springframework.org/schema/context/spring-context.xsd
  13. http://www.springframework.org/schema/jdbc
  14. http://www.springframework.org/schema/jdbc/spring-jdbc.xsd ">
  15.  
  16. <!--find property file. See bean id='dataSource' for example ${jdbc.hsqldb.driverClass}-->
  17. <context:property-placeholder location="classpath:util.properties" />
  18.  
  19. <!-- XML Bean Definitions -->
  20. <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  21. <property name="driverClassName" value="${jdbc.hsqldb.driverClass}" />
  22. <property name="url" value="${jdbc.hsqldb.url}" />
  23. <property name="username" value="${jdbc.hsqldb.username}" />
  24. <property name="password" value="${jdbc.hsqldb.password}" />
  25. </bean>
  26.  
  27. <!-- initialize Embedded DataSource. Встроенная база данных
  28. <jdbc:initialize-database data-source="dataSource">
  29. <jdbc:script location="classpath:dbschema.sql"/>
  30. <jdbc:script location="classpath:test-data.sql"/>
  31. </jdbc:initialize-database>-->
  32.  
  33. <!--Do not forget activate @Transactional JPA annotation with <annotation-driven/>-->
  34. <!-- JPA Persistence Context and EntityManager configuration -->
  35. <bean id="entityManagerFactory"
  36. class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean" >
  37. <!--packagesToScan - search Entity and mapping them -->
  38. <property name="packagesToScan" value="ua.danni.model" />
  39. <property name="dataSource" ref="dataSource" />
  40. <property name="jpaVendorAdapter">
  41. <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter" >
  42. <property name="generateDdl" value="true" />
  43. <property name="showSql" value="true" />
  44. </bean>
  45. </property>
  46. <property name="jpaProperties">
  47. <props>
  48. <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
  49. <prop key="hibernate.show_sql">true</prop>
  50. <prop key="hibernate.format_sql">false</prop>
  51. <prop key="hibernate.hbm2ddl.auto">update</prop>
  52. </props>
  53. </property>
  54. </bean>
  55.  
  56. <!-- Automatic Transaction Participation-->
  57. <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
  58. <property name="entityManagerFactory" ref="entityManagerFactory" />
  59. </bean>
  60.  
  61. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement