Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] JPA section 8.2.1.6.2 question: orm.xml/eclipselink-orm.xml automatically picked up?

Hi Laird,

They should all be processed automatically.. The same would hold true for the eclipselink-orm.xml.

Keep in mind the following though:

1 - similar metadata from 2 orm.xml files will cause an exception.
2 - similar metadata from orm.xml and eclipselink_orm.xml, eclipselink_orm.xml will override
3 - similar metadata from 2 eclipselink_orm.xml files will cause an exception.

Only orm.xml and eclipselink_orm.xml are known file names that are automatically discovered, others should be listed using <mapping-file>

Cheers,
Guy

On 13/06/2013 1:13 PM, Laird Nelson wrote:
I'm trying to figure out when META-INF/orm.xml files are processed automatically.

Section 8.2.1.6.2 of the JPA specification implies that if I name an object-relational mapping file orm.xml and locate it in a META-INF directory of any archive that contains classes being treated as entities, then all such files will be automatically picked up.

But it's actually a pretty unclear section.  You could also read section 8.2.1.6.2 as saying that only one will be picked up automatically, namely the META-INF/orm.xml present at the root of the persistence unit.

I'm not sure which is correct.

Example: I have a .jar file in the lib directory of my .ear file.  It contains META-INF/persistence.xml, thus defining the root of a persistence unit.  I have many other .jar files in that lib directory as well, many of which contain entity classes.  (The entity classes are all processed correctly and normally by EclipseLInk.)  If I place META-INF/orm.xml files in some of those .jar files, but do not reference them explicitly from my persistence.xml, is it supposed to be the case that they all are automatically processed?  Or must I reference each one via a <mapping-file> element?

Would this be true of META-INF/eclipselink-orm.xml as well?

(Background: trying to get batch-fetch elements in META-INF/eclipselink-orm.xml files recognized; not having much luck.)

Best,
Laird


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users

--

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