Persistence.xml file for Hibernate JPA and Mysql

I'm finding it difficult to find an up-to-date and clear explanation of how the persistence.xml should look and what it needs to contain. What would your typical persistence.xml file look like for the following:

  • Provider: Hibernate implementation of JPA
  • Mysql database
  • DB name: hibernatetest
  • username: root
  • password: 12345
  • databases url: localhost port 3306

and for the sake of simplicity say that my Entity class that needs to be persistent is located at com.example.MyClass

Thanks in advance!

Answers


here is an basic persistance.xml example :

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
        version="2.0">
    <persistence-unit name="org.hibernate.tutorial.jpa">
        <class>com.example.MyClass</class>
    <class>...</class>
    <class>...</class>
    </persistence-unit>
</persistence>

You can find more details about it here : http://docs.jboss.org/hibernate/orm/3.6/quickstart/en-US/html/hibernate-gsg-tutorial-jpa.html


Need Your Help

Trouble Implementing Jquery's .each() function on Paired Elements

javascript jquery html each

I thought I had implemented this .each function correctly, but as my script has become more complicated I've noticed some odd results.

jquery - changing bg image of separate div with link

jquery background-image swap

I'm wanting to have the background image of a div change when a link is clicked, but the following isn't working. Also would like it to fade if that's possible...