Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Verifying whether eclipselink-orm.xml is being picked up

Alternatively, did you try adding:

<mapping-file>META-INF/eclipselink-orm.xml</mapping-file>

to your persistence.xml directly? The same discovery issue would also hold true if it were an orm.xml file and I don't believe EclipseLink is violating the JPA spec in this case (but I'll dig further)

Cheers,
Guy

On 18/06/2013 2:01 PM, Laird Nelson wrote:
On Tue, Jun 18, 2013 at 9:11 AM, Guy Pelletier <guy.pelletier@xxxxxxxxxx> wrote:
I'm not sure exactly why your el-orm.xml is not being picked up. If it is available at runtime from META-INF/eclipselink-orm.xml it should definitely be picked up.

What I found from debugging EclipseLink is that it is only picked up if it is either a sibling of persistence.xml or in a *jar file's* META-INF directory (when the jar file is on the classpath, obviously).  It is *not* picked up if it is in a META-INF directory in another *directory* classpath root.

So in my unit/integration test area, I have (Maven users will recognize this layout):

target/classes/META-INF/eclipselink-orm.xml // I want this available if and when my jar is eventually packaged
target/test-classes/META-INF/persistence.xml // I only want this for testing

In this setup, the classpath is effectively:

target/test-classes:target/classes

...and META-INF/eclipselink-orm.xml is not loaded.  (You can see for yourself; the roots that are scanned for eclipselink-orm.xml come from (a) the place (wherever that is) where persistence.xml is found and (b) PersistenceUnitInfo#getJarFileUrls().  Obviously in this layout there are no jar file URLs to return, so only a sibling of persistence.xml is found in target/test-classes.)

Best,
Laird

--
http://about.me/lairdnelson

--

Oracle
Guy Pelletier

ORACLE Canada, 45 O'Connor Street Suite 400 Ottawa, Ontario Canada K1P 1A4

Green
            Oracle Oracle is committed to developing practices and products that help protect the environment


Back to the top