Reputation: 1315
I have an eclipse project with several jars for JPA / Hibernate. One of tham contains a META-INF/persistence.xml
and I want to override that by defining my own persistence.xml
. So I tried using my persistence.xml
in src/persistence.xml
also src/META-INF/persistence.xml
but everytime it seems jar/META-INF/persistence.xml
gets picked up.
I also tried editing .classpath
file of eclipse projects and moved up classpathentry path="bin"
higher up than the library included but still its not picking up my persistence.xml
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="src" path="src/main/rules"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
<classpathentry kind="con" path="DROOLS/Drools"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/drools"/>
</classpath>
In the tutorial I read:
You will need to override these defaults if you want to change them, by adding your own persistence.xml in your classpath, preceding the default one in drools-persistence-jpa.jar
Upvotes: 3
Views: 1335
Reputation: 570475
So I tried using my persistence.xml in src/persistence.xml also src/META-INF/persistence.xml but every time it seems jar/META-INF/persistence.xml gets picked up.
The persistence.xml
should be located under META-INF/persistence.xml
so the first attempt won't work. And when I look at your .classpath
file, I don't see src
as source path so the second attempt won't work either.
Try src/main/java/META-INF/persistence.xml
instead.
Actually, your project layout really looks like a Maven layout and with Maven, resources typically go to src/main/resources
or src/test/resources
. But since you didn't mention what tutorial you're following, I can't confirm if this applies here.
Anyway, my suggestion should work.
Upvotes: 3