users@glassfish.java.net

Re: orm.xml not being used? (either ignored or ValidationException)

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Tue, 30 Jan 2007 11:45:27 -0800

It can be part of this bug:
https://glassfish.dev.java.net/issues/show_bug.cgi?id=1234

The mapping descriptors are read using getResourceAsStream (as per the spec
requirement) so if there are more than one file name META-INF/mappings.xml on
your classpath, the provider doesn't know which one to use, and reports a problem.

thanks,
-marina

Gordon Yorke wrote:
> Hello Tom,
> Have you attempted any other settings, perhaps updating the table name of one of the entities to determine if it is a problem with TopLink finding the orm.xml or if it is a problem with the default schema name specifically. The XML appears correct, please file a bug report.
> --Gordon
>
> -----Original Message-----
> From: Tom Mutdosch [mailto:tommut_at_gmail.com]On Behalf Of Tom Mutdosch
> Sent: Tuesday, January 30, 2007 9:15 AM
> To: users_at_glassfish.dev.java.net
> Subject: orm.xml not being used? (either ignored or ValidationException)
>
>
> Hi all,
>
> I am having a problem with my orm.xml not being found in a JSF web
> application running on Glassfish (glassfish-installer-v2-b32.jar).
>
> I have entities that I am persisting to a DB2 database, and I want to
> set the default schema. Rather than setting the schema annotation on
> every Java entity, I want to specify it in the orm.xml file. The path
> is /META-INF/orm.xml (next to persistence.xml) and it looks like:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>
> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm orm_1_0.xsd"
> version="1.0">
> <persistence-unit-metadata>
> <persistence-unit-defaults>
> <schema>ADMINISTRATOR</schema>
> </persistence-unit-defaults>
> </persistence-unit-metadata>
> </entity-mappings>
>
> However when I try to execute a query on my entity, I get a DB2 error as
> it is still incorrectly using the default DB2 schema, and not the one I
> specified:
> com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -204, SQLSTATE:
> 42704, SQLERRMC: DB2ADMIN.DEPARTMENT
>
> I then tried to place the mapping information in a separate
> /META-INF/mappings.xml and pointed to it from my persistence.xml:
> <mapping-file>/META-INF/mappings.xml</mapping-file>
>
> In this case, when I run on the server I get the following exception:
> Exception [TOPLINK-7252] (Oracle TopLink Essentials - 9.1 (Build b32)):
> oracle.toplink.essentials.exceptions.ValidationException
> Exception Description: There are multiple mapping files called
> [/META-INF/mappings.xml] in classpath for persistence unit named [ pu ].
>
> Does anyone know what might be causing this?
>
> Thanks
> Tom
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>