jpa:hibernate
JPA vs. Hibernate configuration files
There are two configuration files:
pom.xml
/src
/main
/resources
hibernate.cfg.xml
/META-INF
persistence.xml
For pure Hibernate API, we should use hibernate.cfg.xml.
For JPA (Java Persistence API), the persistence.xml file should be used.
Migrating from Hibernate API to JPA
If we have a pure Hibernate API project, we can use the existing configuration file in a new JPA project.
Add in persistence.xml the property hibernate.ejb.cfgfile
<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_1_0.xsd"
version="1.0"
>
<persistence-unit name="employee">
<properties>
<property name="hibernate.ejb.cfgfile" value="/hibernate.cfg.xml" />
</properties>
</persistence-unit>
</persistence>
jpa/hibernate.txt · Last modified: by 127.0.0.1
