Posted By

thebugslayer on 09/23/07


Tagged

java Hibernate jpa


Versions (?)

persistence.xml for Hibernate vendor


 / Published in: Java
 

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

  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  

You need to login to post a comment.