0

I'm new in personal projects, and i have a confusion in start with JPA/Hibernate 2.1

Some tutorials say that you have to put persistence.xml in the /META-INF folder. And some others say that you might have a hibernate.cfg.xml in the root folder.

What is the best practice ?

Is there one for local deployment and another for remote deployment ?

Thank you in advance.

jozinho22
  • 459
  • 2
  • 7
  • 24
  • Does this answer your question? [what is the purpose of two config files for Hibernate?](https://stackoverflow.com/questions/3807503/what-is-the-purpose-of-two-config-files-for-hibernate) – PaulD May 12 '20 at 10:11

1 Answers1

0

JPA is the Java Persistence API specification. It's just an API. Hibernate is a persistence framework that implements the JPA specification. There are others implementations of JPA like EclipseLink.

If you want to use the JPA API, with Hibernate as a persistence provider, you need to use persitence.xml file.

If you are not using the JPA, and just want to use the Hibernate api directly, you could use hibernate.cfg.xml or just an hibernate.properties file.

areus
  • 2,880
  • 2
  • 7
  • 17