persistence@glassfish.java.net

[Fwd: [Issue 1074] Regression: TopLink does not serach classpath for mapping files specified in persistence.xml]

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Fri, 08 Sep 2006 13:44:00 -0700

Team,

Do you have any idea of a simpler/better/nicer solution for locating mapping
files in a PU?

thanks,
-marina

-------- Original Message --------
From: mvatkina_at_dev.java.net
Subject: [Issue 1074] Regression: TopLink does not serach classpath for mapping
files specified in persistence.xml

https://glassfish.dev.java.net/issues/show_bug.cgi?id=1074



User mvatkina changed the following:

                 What |Old value |New value
================================================================================
                   Status|NEW |STARTED
--------------------------------------------------------------------------------




------- Additional comments from mvatkina_at_dev.java.net Fri Sep 8 20:41:35 +0000
2006 -------
Here is what I learned about the current implementation:

1. Because there can be more than 1 persistence.xml on the classpath,
META-INF/orm.xml or any other mapping file referenced from a persistence.xml,
must be 1st looked up in the PU root or in any jar file referenced from that
persistence.xml. Otherwise we can get some other PU's mapping files that are
accidentally on the classpath (is it a spec oversight that there is no PU name
in the mapping file?).
This is accomplished by steps 1 and 2 in
PersistenceUnitProcessor.createInputStreamForFileInPersistenceUnit().

2. In Tomcat the PU root is returned by a complicated URL that is handled by
step 3 in the above method.

The solution would be to add getResourceAsStream call as the 4th step, but it's
not clear if we should attempt to do so for the default mapping file
(META-INF/orm.xml).