Yes, I see the schema name prefixed in the query and of course it is
needed to load from db.

Are you passing those properties to the emf during creation? Instead,
you can (just to verify) try setting them in persistence.xml by adding
a properties element like this:
 <persistence-unit name="PatternRepo">
      .....
     <properties>

            <property name="openjpa.jdbc.Schema" value="DEV" />
    </properties>
</persistence-unit>

or if you're using spring framework, then (I externalize these
properties using PropertyPlaceholderConfigurer)

<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="jpaVendorAdapter">
            <bean
class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter" />
        </property>
        <property name="jpaPropertyMap">
            <map>
                <entry key="openjpa.jdbc.Schema" value="DEV" />
            </map>
         </property>
 </bean>

//
Prashant


On Jan 9, 2008 6:31 PM, Adam Hardy <[EMAIL PROTECTED]> wrote:
> If you see the schema names in the debug logging of query SQL, then maybe you
> can see something in my config that causes my issue - but if you aren't meant 
> to
> see the schema name in the logging, it could be something as simple as a
> database incompatibility.
>
> I checked that the schema exists! It does.
>
> <?xml version="1.0" encoding="UTF-8"?>
> <persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence";
>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>    xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
> http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd";>
>    <persistence-unit name="PatternRepo">
>      <description>Pattern Repo JPA Config</description>
>      
> <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
>      <mapping-file>org/permacode/patternrepo/orm/Category.xml</mapping-file>
>      <mapping-file>org/permacode/patternrepo/orm/Market.xml</mapping-file>
>      <mapping-file>org/permacode/patternrepo/orm/Code.xml</mapping-file>
>      <mapping-file>org/permacode/patternrepo/orm/TestResult.xml</mapping-file>
>      
> <mapping-file>org/permacode/patternrepo/orm/TradingParam.xml</mapping-file>
>    </persistence-unit>
> </persistence>
>
> 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>
>      <xml-mapping-metadata-complete />
>      <persistence-unit-defaults>
>        <schema>DEV</schema>
>      </persistence-unit-defaults>
>    </persistence-unit-metadata>
> </entity-mappings>
>
> the properties I set in code:
> openjpa.ConnectionUserName=sa
> openjpa.ConnectionPassword=
> openjpa.ConnectionURL=jdbc:hsqldb:mem:TRADING_CODE
> openjpa.ConnectionDriverName=org.hsqldb.jdbcDriver
> openjpa.jdbc.Schema=DEV
> openjpa.jdbc.SchemaFactory=native(ForeignKeys=true)
> openjpa.jdbc.DBDictionary=org.apache.openjpa.jdbc.sql.HSQLDictionary
> openjpa.Log=log4j
> openjpa.Id=[PatternRepo OpenJPA]
>
>
> The mappings won't help but this is it:
>
> openjpa.MetaDataFactory:jpa(Resources=org/permacode/patternrepo/orm/Category.xml;
> org/permacode/patternrepo/orm/Market.xml;
> org/permacode/patternrepo/orm/Code.xml;
> org/permacode/patternrepo/orm/TestResult.xml;
> org/permacode/patternrepo/orm/TradingParam.xml;
> org/permacode/patternrepo/orm/CategoryCodeLink.xml;
> org/permacode/patternrepo/orm/TestQueries.xml)
>
>

Reply via email to