How do I create a persistence.xml file for JPA and Hibernate?

前端 未结 2 1050
逝去的感伤
逝去的感伤 2021-01-04 13:21

I\'m trying to use Hibernate JPA but I need to create my persistence.xml (so I can use the entity manager correctly). I am unsure of what to create and where to place it.

2条回答
  •  無奈伤痛
    2021-01-04 13:51

    Create a persistence.xml file that resides in the META-INF folder.

    Example:

    
    
      org.hibernate.ejb.HibernatePersistence
      java:/DefaultDS
      ormap.xml
      MyApp.jar
      org.acme.Employee
      org.acme.Person
      org.acme.Address
      
         com.mysql.jdbc.Driver
         XXXXXX
         jdbc:mysql:///
         XXXXX
         XXXXXX
         org.hibernate.dialect.MySQLDialect
       
      
    
    

提交回复
热议问题