persistence.xml for Hibernate vendor


/ Published in: Java
Save to your folder(s)

this goes under src/main/resource/META-INF/persistence.xml


Copy this code and paste it in your HTML
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <persistence xmlns="http://java.sun.com/xml/ns/persistence"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
  5. version="1.0">
  6.  
  7. <persistence-unit name="default">
  8. <provider>org.hibernate.ejb.HibernatePersistence</provider>
  9. <properties>
  10. <!-- Auto detect annotation model classes -->
  11. <property name="hibernate.archive.autodetection" value="class"/>
  12.  
  13. <!-- Datasource -->
  14. <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
  15. <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
  16. <property name="hibernate.connection.username" value="root"/>
  17. <property name="hibernate.connection.password" value=""/>
  18. <property name="hibernate.connection.url" value="jdbc:mysql://localhost/myhibernatejpa_dev"/>
  19.  
  20. </properties>
  21. </persistence-unit>
  22. </persistence>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.