Advertisement
Guest User

Untitled

a guest
Oct 15th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.90 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:jpa="http://www.springframework.org/schema/data/jpa"
  5. xmlns:tx="http://www.springframework.org/schema/tx"
  6. xmlns:jee="http://www.springframework.org/schema/jee"
  7. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
  8. http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
  9. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
  10. http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-4.0.xsd">
  11.  
  12.  
  13.  
  14. <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  15. <property name="driverClassName" value="org.postgresql.Driver" />
  16. <property name="url" value="jdbc:postgresql://localhost:5432/testapplicationDB" />
  17. <property name="username" value="root" />
  18. <property name="password" value="root" />
  19. </bean>
  20.  
  21.  
  22.  
  23. <!-- Configure the data source bean -->
  24. <jee:jndi-lookup id="dataSource" jndi-name="java:comp/env/jdbc/CustomerSupport"/>
  25.  
  26. <!-- Create default configuration for Hibernate -->
  27. <bean id="hibernateJpaVendorAdapter"
  28. class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"/>
  29.  
  30. <!-- Configure the entity manager factory bean -->
  31. <bean id="entityManagerFactory"
  32. class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
  33. <property name="dataSource" ref="dataSource"/>
  34. <property name="jpaVendorAdapter" ref="hibernateJpaVendorAdapter"/>
  35. <!-- Set JPA properties -->
  36. <property name="jpaProperties">
  37. <props>
  38. <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</prop>
  39. <prop key="javax.persistence.schema-generation.database.action">none</prop>
  40. <prop key="hibernate.ejb.use_class_enhancer">true</prop>
  41. </props>
  42. </property>
  43. <!-- Set base package of your entities -->
  44. <property name="packagesToScan" value="com.testapp.model"/>
  45. <!-- Set share cache mode -->
  46. <property name="sharedCacheMode" value="ENABLE_SELECTIVE"/>
  47. <!-- Set validation mode -->
  48. <property name="validationMode" value="NONE"/>
  49. </bean>
  50.  
  51. <!-- Configure the transaction manager bean -->
  52. <bean id="transactionManager"
  53. class="org.springframework.orm.jpa.JpaTransactionManager">
  54. <property name="entityManagerFactory" ref="entityManagerFactory"/>
  55. </bean>
  56.  
  57. <!-- Enable annotation driven transaction management -->
  58. <tx:annotation-driven/>
  59.  
  60. <!--
  61. Configure Spring Data JPA and set the base package of the
  62. repository interfaces
  63. -->
  64. <jpa:repositories base-package="com.testapp.repository"/>
  65.  
  66. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement