Advertisement
Guest User

Untitled

a guest
Oct 13th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.19 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <persistence
  3. xmlns="http://java.sun.com/xml/ns/persistence"
  4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  5. xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
  6. http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
  7. version="1.0">
  8.  
  9. <persistence-unit name="naveroTest">
  10. <provider>org.hibernate.ejb.HibernatePersistence</provider>
  11. <class>xxx</class>
  12. ...
  13.  
  14.  
  15. <properties>
  16. <property name="hibernate.archive.autodetection" value="class, hbm"/>
  17. <property name="hibernate.show_sql" value="true"/>
  18. <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
  19. <property name="hibernate.connection.url" value="jdbc:hsqldb:file:/tmp/naveroTestDB"/>
  20. <property name="hibernate.connection.username" value="sa"/>
  21. <property name="hibernate.connection.password" value=""/>
  22. <property name="hibernate.hbm2ddl.auto" value="create"/>
  23. <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
  24. </properties>
  25. </persistence-unit>
  26. </persistence>
  27.  
  28. <?xml version="1.0" encoding="UTF-8"?>
  29. <beans xmlns:tx="http://www.springframework.org/schema/tx"
  30. xmlns="http://www.springframework.org/schema/beans"
  31. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  32. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
  33. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
  34. http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd">
  35.  
  36. <!-- For auto creation of tables -->
  37. <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  38. <property name="driverClassName" value="org.hsqldb.jdbcDriver" />
  39. <property name="url" value="jdbc:hsqldb:file:/tmp/naveroTestDB" />
  40. <property name="username" value="sa" />
  41. <property name="password" value="" />
  42. </bean>
  43.  
  44. <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
  45. <property name="dataSource" ref="dataSource" />
  46. <property name="loadTimeWeaver">
  47. <bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver" />
  48. </property>
  49. <property name="jpaVendorAdapter">
  50. <bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
  51. <property name="generateDdl" value="true" />
  52. <property name="databasePlatform" value="org.hibernate.dialect.HSQLDialect" />
  53. <property name="showSql" value="true" />
  54. </bean>
  55. </property>
  56. </bean>
  57.  
  58. <bean id="PictureBean" class="de.navero.server.bl.PictureBean">
  59. <property name="entityManagerFactory"><ref local="entityManagerFactory" /></property>
  60. </bean>
  61.  
  62. </beans>
  63.  
  64. <?xml version="1.0" encoding="UTF-8"?>
  65. <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/
  66. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  67. xsi:schemaLocation="http://.sun.com/xml/ns/persistence
  68. http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
  69. <persistence-unit name="naveroTest" transaction-type="RESOURCE_LOCAL" />
  70. </persistence>
  71.  
  72. <?xml version="1.0" encoding="UTF-8"?>
  73. <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
  74. <property name="jpaVendorAdapter">
  75. <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"/>
  76. </property>
  77. <property name="jpaProperties">
  78. <props>
  79. ...
  80. <prop key="hibernate.hbm2ddl.auto">create-drop</prop>
  81. </props>
  82. </property>
  83. <property name="dataSource" ref="dataSource" />
  84. </bean>
  85.  
  86. <!--property name="generateDdl" value="true"--> in the JpaAdapter,
  87.  
  88. <property name="hibernate.hbm2ddl.auto" value="create"/> in persistence.xml
  89.  
  90. <property name="hibernate.hbm2ddl.auto">update</property>
  91.  
  92. <?xml version="1.0" encoding="UTF-8"?>
  93. <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
  94. <hibernate-configuration>
  95. <session-factory>
  96. <property name="dialect">
  97. org.hibernate.dialect.MySQLDialect
  98. </property>
  99. <property name="current_session_context_class">thread</property>
  100. <!-- When an HQL statement declares a true/false, replace with the standard Y/N -->
  101. <property name="hibernate.query.substitutions">true 'Y', false 'N'</property>
  102. <!-- A useful property do debugging queries. Besure sure it is false or commented out when going PROD -->
  103. <!-- <property name="hibernate.show_sql">true</property> -->
  104. <!-- Format the printed out SQL generated by Hibernate -->
  105. <property name="hibernate.format_sql">false</property>
  106. <!-- If enabled, Hibernate will collect statistics useful for performance tuning - JMX -->
  107. <property name="hibernate.generate_statistics">false</property>
  108.  
  109. <property name="hibernate.hbm2ddl.auto">update</property>
  110.  
  111. <mapping class=....
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement