Persistence.xml where to put in eclipse project

Marcin Petrów picture Marcin Petrów · Jun 6, 2011 · Viewed 33.3k times · Source

Simple question...
I have a few projects in Eclipse enviroment
MainApp(Enterprise Application Project) which "includes"

  1. WebController (EJB Project)
  2. WebModel (JPA Project)
  3. WebView(Dynamic Web Project)


Problem is where to put persistance.xml file?

Getting exception: java.lang.IllegalStateException: Unable to retrieve EntityManagerFactory for unitName DataModel

Answer

Vineet Reynolds picture Vineet Reynolds · Jun 6, 2011

The persistence.xml file is typically present in the src/META-INF directory of the persistence (JPA) project. If the project was created with Eclipse, it is typically created and placed there by default.