score:38
It shouldn't be at the project root, but directly under the source folder.
At runtime, the persistence.xml file is searched in the classpath, under META-INF. So if you want the META-INF folder to be put at the top of the compiled package tree, you need to put it at the top of the source tree. Eclipse copies every non-Java file to its output directory (bin, by default), respecting the package/folder hierarchy.
score:2
If you are using Eclipse, right-click on 'src' folder, choose 'Build Path', then 'Use as Source Folder'
score:12
It should be under src/main/resources
directory,
The full path will be /src/main/resources/META-INF/persistence.xml
After creating the META-INF folder under resources directory and having a persistence.xml file loads the entityMangerFactory bean properly,
<property name="persistenceXmlLocation" value="classpath:META-INF/persistence.xml" />
The above line reads the path correctly.
score:26
Basically it has to be in your classpath(under /META-INF/
). You can manually enable it in eclipse by configuring properties. If your project is maven based, then it should be automatically picked from /src/main/resources/META-INF/
folder (provided entities are under the same hood).
Source: stackoverflow.com
Related Query
- Where is the correct location to put Log4j.properties in an Eclipse project?
- where to put .properties files in an Eclipse project?
- Where to put google-services.json file into eclipse project?
- Persistence.xml where to put in eclipse project
- Where to put context.xml with Eclipse WTP?
- Servlet in Eclipse - Where to put static content
- Where to put properties file in eclipse and how to access the path both locally and on server
- Where put "resources" dir on eclipse
- Where do you put server.xml in a tomcat eclipse project when checking into version control?
- Where do I put images in the eclipse resource folder?
- where to put the properties file in an eclipse project
- Where does Eclipse put your apk files (that you're developing and testing)?
- Where should I put an external JAR file in my Eclipse project?
- Where to put business logic in Eclipse RCP program
- How do I set the Eclipse preference for where to put the + when breaking a String up over multiple lines?
- Where does Eclipse itself put the self signed plugin cert, if not the cacerts file?
- Eclipse configuration: where to put external libs?
- Where should I put the ical4j.properties file in an Eclipse Android project?
- Where to put Database file in Eclipse RCP application?
- Where do you put -Dvar=value arguments in Eclipse debug configurations?
- how to put javaw.exe where eclipse can find it
- Where to put persistence.xml in a Eclipse EJB Gradle project?
- Eclipse dynamic web project : where should I put resource files
- Where do we specify in Eclipse the place to put the built classes?
- Where to put text files in an Eclipse Dynamic Web Project
- To use .jsp pages with Eclipse on Mac, Where do I have to put .java or .class files?
- where to put src images in Eclipse web project
- Where in an Eclipse workspace is the list of projects stored?
- Where is web.xml in Eclipse Dynamic Web Project
- Where does Eclipse store preferences?
More Query from same tag
- Run kie server source code in Eclipse
- Intro part shows null pointer exception
- Tomcat server does not start with DCEVM patched JRE
- Contacts wont show up into EditText
- How to use Admob in Eclipse?
- Android media sound Recorder Start failed
- Android build fail in eclipse with a dx error when exporting maven dependencies
- Filter Eclipse's "Open Call Hierarchy" to just my company/project
- Problems occurred when invoking code from plug-in: "org.eclipse.jface"
- How to integrate c++ classes and objects around winApi?
- Can't get eclipse kepler to deploy dependency projects of dynamic web project
- How can I get rid of the warning m2eclipse "goals inplace, exploded, manifest are ignored by m2e"
- Can I install additional encodings in eclipse?
- Java with a compiled C dll issue
- Wait for any background progress going on in eclipse while testing using SWT Bot
- Yet another 'member declaration not found'
- Can't deploy correctly required project with Eclipse
- SEVERE: Error filterStart , when try to deploy WAR file in Eclipse to Tomcat server
- Avoid ant and build automatically instead via eclipse.Is it possible?
- Can’t import class from JAR despite JAR including it (Eclipse)
- How to fix position of layout in a view in eclipse
- How to add images to resource chooser?
- Eclipse auto refactor String comparision
- I have a Java Applet working in Eclipse but not working as embedded applet
- Missing artifact com.splunk:splunk:jar:1.6.0.0
- How can I execute a script inside an Eclipse Plugin?
- HTML5 sound problems on Android
- Where to import mongo-2.10.1 jar in REST Web Server
- Is it possible to change Eclipse's window color (grey to something else)?
- Eclipse not deploy all the jar files for a web app