Guest User

Untitled

a guest
Jun 24th, 2016
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.29 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3.     xmlns:p="http://www.springframework.org/schema/p"
  4.     xmlns:context="http://www.springframework.org/schema/context"
  5.     xmlns:tx="http://www.springframework.org/schema/tx"
  6.     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  7.     xsi:schemaLocation="
  8.         http://www.springframework.org/schema/beans
  9.         http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  10.         http://www.springframework.org/schema/context
  11.         http://www.springframework.org/schema/context/spring-context-3.0.xsd
  12.         http://www.springframework.org/schema/tx
  13.         http://www.springframework.org/schema/tx/spring-tx.xsd
  14.         ">
  15.        
  16.     <context:component-scan base-package="ar.com.globallogic.spring.orm" />
  17.     <context:annotation-config />
  18.    
  19.    
  20.     <!-- DataSource -->
  21.     <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  22.         <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  23.         <property name="url" value="jdbc:mysql://localhost:3306/spring" />
  24.         <property name="username" value="root" />
  25.         <property name="password" value="root" />
  26.        
  27.     </bean>
  28.    
  29.     <bean id="sessionFactory"
  30.          class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"
  31.          depends-on="dataSource">
  32.             <property name="hibernateProperties">
  33.                 <props>
  34.                   <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
  35.                   <prop key="hibernate.show_sql">true</prop>
  36.                   <prop key="hibernate.hbm2ddl.auto">create  </prop>    
  37.                 </props>
  38.              </property>
  39.     </bean>
  40.     <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean"
  41.             p:packagesToScan="ar.com.globallogic.spring.orm.model"
  42.            p:dataSource-ref="dataSource"
  43.             >
  44.         <property name="jpaVendorAdapter">
  45.             <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
  46.                 <property name="generateDdl" value="true" />
  47.                 <property name="showSql" value="true" />
  48.             </bean>
  49.         </property>
  50.     </bean>
  51.  
  52.     <!-- Transactions -->
  53.     <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
  54.         <property name="entityManagerFactory" ref="entityManagerFactory" />
  55.     </bean>
  56.     <tx:annotation-driven transaction-manager="transactionManager" />
  57.  
  58. </beans>
Add Comment
Please, Sign In to add comment