Where is Persistence.createEntityManagerFactory () looking for a save block?

I am using eclipse. I am trying to debug an inability to find a persistence block that really resides in the directory structure of my eclipse project.

Where EntityManagerFactory javax.persistence.Persistence.createEntityManagerFactory(String persistenceUnitName, Map properties)to look for the save block?

When I ask where it looks, I mean all the possible resources that can be found, including eclipse configurations, properties in the persistence.xml file, if found, resources found by included JARs, etc. To learn how this works, I run a test program by right-clicking on the Main.java class located in the root directory ( src/main/java) of the eclipse project.

The answer can help me figure out how to set up an eclipse project so that I EntityManagerFactory javax.persistence.Persistence.createEntityManagerFactory(String persistenceUnitName, Map properties)can find the save block.

+4
source share
1 answer

It searches for your persistence.xml located inside your META-INF directory. This folder should be at the same level as your root package.

In the maven project, the folder will be located in / src / main / resources / META-INF / persistence.xml

+4
source

All Articles