Advertisement
tornadoKatcher

jpaContext

Apr 7th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.08 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:tx="http://www.springframework.org/schema/tx"
  5.     xmlns:context="http://www.springframework.org/schema/context"
  6.     xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  7.         http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
  8.         http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd">
  9.  
  10.     <context:annotation-config/>
  11.    
  12.     <context:component-scan base-package="com.rockstars"/>
  13.    
  14.     <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
  15.    
  16.  
  17.     <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
  18.         <property name="persistenceUnitName" value="punit"/>
  19.         <property name="dataSource" ref="dataSource"/>
  20.         <property name="jpaVendorAdapter">
  21.             <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
  22.                 <property name="showSql" value="true" />
  23.             </bean>
  24.         </property>
  25.         <property name="jpaPropertyMap">
  26.             <map>
  27.                 <entry key="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
  28.                 <entry key="hibernate.hbm2ddl.auto" value="create"/>
  29.                 <entry key="hibernate.format_sql" value ="true"/>
  30.             </map>
  31.         </property>
  32.     </bean>
  33.    
  34.     <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
  35.         <property name="entityManagerFactory" ref="entityManagerFactory"/>
  36.    
  37.     </bean>
  38.    
  39.     <tx:annotation-driven transaction-manager="transactionManager" />
  40.    
  41.     <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  42.         <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  43.         <property name="url" value="jdbc:mysql://localhost:3306/organizer?autoReconnect=true"/>
  44.         <property name="username" value = "root"/>
  45.         <property name="password" value = "admin"/>
  46.    
  47.     </bean>
  48.    
  49.    
  50. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement