Advertisement
Guest User

Untitled

a guest
Aug 13th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 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:context="http://www.springframework.org/schema/context"
  5. xsi:schemaLocation= "http://www.springframework.org/schema/beans
  6. http://www.springframework.org/schema/beans/spring-beans.xsd
  7. http://www.springframework.org/schema/context
  8. http://www.springframework.org/schema/context/spring-context.xsd">
  9.  
  10. <!-- Database properties -->
  11. <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  12. <property name="driverClassName" value="org.postgresql.Driver" />
  13. <property name="url" value="jdbc:postgresql://127.0.0.1:5432/spring_jdbc" />
  14. <property name="username" value="postgres" />
  15. <property name="password" value="1" />
  16. </bean>
  17.  
  18. <!-- Connecting template -->
  19. <bean id="template" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
  20. <property name="dataSource" ref="dataSource" />
  21.  
  22. <property name="mappingResources">
  23. <list>
  24. <value>ru/pravvich/Item.hbm.xml</value>
  25. </list>
  26. </property>
  27.  
  28. <!-- Hibernate properties -->
  29. <property name="hibernateProperties">
  30. <props>
  31. <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQL94Dialect</prop>
  32. <prop key="hibernate.hbm2ddl.auto">update</prop>
  33. <prop key="hibernate.show_sql">true</prop>
  34. </props>
  35. </property>
  36. </bean>
  37.  
  38. <context:component-scan base-package="ru.pravvich" />
  39.  
  40. </beans>
  41.  
  42. final ClassPathXmlApplicationContext context =
  43. new ClassPathXmlApplicationContext("hibernate-context.xml");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement