Currently the settings in your mapping file only apply to the entities in the mapping file.
OpenJPA-198 : https://issues.apache.org/jira/browse/OPENJPA-198 was opened to address having the schema name (and other default properties) apply to the entire PU. For the time being you'll have to either add your mappings to orm.xml or use the openjpa.jdbc.Schema property (either in persistence.xml, in openjpa.xml, or as a system property). Regards, -Mike On 8/16/07, Tom Mutdosch <[EMAIL PROTECTED]> wrote: > > Hi there, > > I am using a DB2 database and I can't seem to easily set the default > schema for all of my entities using the orm.xml. I guess by default, > openjpa uses a schema based on the username. In my case, my username is > DB2ADMIN, but there is no schema by that name; instead the schema is > ADMINISTRATOR. I tried to set the default schema in the meta-inf/orm.xml: > > <?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 > http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" version="1.0"> > <persistence-unit-metadata> > <persistence-unit-defaults> > <schema>ADMINISTRATOR</schema> > </persistence-unit-defaults> > </persistence-unit-metadata> > <schema>ADMINISTRATOR</schema> > </entity-mappings> > > That didn't seem to work. It still failed at runtime trying to find the > table using the wrong schema (the runtime logging did show that the > correct orm.xml was being processed properly.) I am able to set the > default schema successfully using an openjpa property in the > persistence.xml: > <property name="openjpa.jdbc.Schema" value="ADMINISTRATOR"/> > > But that isn't very portable. Do you know if I should be able to > specify the schema in the orm.xml in this fashion? Or does that only > work if I have my entity mappings defined in the orm.xml as well? > > Thanks > Tom > >
