users@glassfish.java.net

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

From: Gordon Yorke <gordon.yorke_at_oracle.com>
Date: Tue, 30 Jan 2007 11:20:18 -0500

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