[jira] Created: (OPENJPA-483) configuration for openjpa.jdbc.Schemas not applied to SQL

6 messages Options
Embed this post
Permalink
JIRA jira@apache.org

[jira] Created: (OPENJPA-483) configuration for openjpa.jdbc.Schemas not applied to SQL

Reply Threaded More More options
Print post
Permalink
configuration for openjpa.jdbc.Schemas not applied to SQL
---------------------------------------------------------

                 Key: OPENJPA-483
                 URL: https://issues.apache.org/jira/browse/OPENJPA-483
             Project: OpenJPA
          Issue Type: Bug
    Affects Versions: 1.1.0
         Environment: Java JDK 1.5.0_12, Linux, Hypersonic DB
            Reporter: Adam Hardy


OpenJPA should be able to see and access schemas but doesn't.

I configured this with openjpa.jdbc.Schema=DEV (my schema name)

I also tried putting the schema name everywhere possible in the metadata, i.e. in the <schema>DEV</schema> tags and in table tags, and in:

  <persistence-unit-metadata>
    <xml-mapping-metadata-complete />
    <persistence-unit-defaults>
      <schema>DEV</schema>
    </persistence-unit-defaults>
  </persistence-unit-metadata>

I will include a zipped up test project illustrating the problem.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

JIRA jira@apache.org

[jira] Updated: (OPENJPA-483) configuration for openjpa.jdbc.Schemas not applied to SQL

Reply Threaded More More options
Print post
Permalink

     [ https://issues.apache.org/jira/browse/OPENJPA-483?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Hardy updated OPENJPA-483:
-------------------------------

    Attachment: schemabug.zip

Running the test will produce the following exception. Logging shows that the schema does exist at runtime.

<openjpa-1.1.0-SNAPSHOT-rexported fatal user error> org.apache.openjpa.persistence.ArgumentException: Errors encountered while resolving metadata.  See nested exceptions for details.
        at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:559)
        at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:304)
        at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:241)
        at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:212)
        at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:182)
        at org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:121)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:311)
        at org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:229)
        at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:191)
        at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
        at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192)
        at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:145)
        at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:56)
        at org.permacode.patternrepo.jpa.ProgrammaticTransactionIntegrationTest.test(ProgrammaticTransactionIntegrationTest.java:71)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
        at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
        at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
        at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
        at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
        at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
        at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
        at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
        at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
        at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: <openjpa-1.1.0-SNAPSHOT-rexported fatal user error> org.apache.openjpa.persistence.ArgumentException: Table "CATEGORY" given for "org.permacode.patternrepo.domain.Category" does not exist.
        at org.apache.openjpa.jdbc.meta.MappingInfo.createTable(MappingInfo.java:470)
        at org.apache.openjpa.jdbc.meta.ClassMappingInfo.getTable(ClassMappingInfo.java:229)
        at org.apache.openjpa.jdbc.meta.strats.FullClassStrategy.map(FullClassStrategy.java:71)
        at org.apache.openjpa.jdbc.meta.ClassMapping.setStrategy(ClassMapping.java:373)
        at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:55)
        at org.apache.openjpa.jdbc.meta.MappingRepository.prepareMapping(MappingRepository.java:323)
        at org.apache.openjpa.meta.MetaDataRepository.preMapping(MetaDataRepository.java:658)
        at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:545)
        ... 37 more
NestedThrowables:
<openjpa-1.1.0-SNAPSHOT-rexported fatal user error> org.apache.openjpa.persistence.ArgumentException: Table "CATEGORY" given for "org.permacode.patternrepo.domain.Category" does not exist.
        at org.apache.openjpa.jdbc.meta.MappingInfo.createTable(MappingInfo.java:470)
        at org.apache.openjpa.jdbc.meta.ClassMappingInfo.getTable(ClassMappingInfo.java:229)
        at org.apache.openjpa.jdbc.meta.strats.FullClassStrategy.map(FullClassStrategy.java:71)
        at org.apache.openjpa.jdbc.meta.ClassMapping.setStrategy(ClassMapping.java:373)
        at org.apache.openjpa.jdbc.meta.RuntimeStrategyInstaller.installStrategy(RuntimeStrategyInstaller.java:55)
        at org.apache.openjpa.jdbc.meta.ClassMapping.resolveMapping(ClassMapping.java:797)
        at org.apache.openjpa.meta.ClassMetaData.resolve(ClassMetaData.java:1618)
        at org.apache.openjpa.meta.MetaDataRepository.processBuffer(MetaDataRepository.java:712)
        at org.apache.openjpa.meta.MetaDataRepository.resolveMapping(MetaDataRepository.java:673)
        at org.apache.openjpa.meta.MetaDataRepository.resolve(MetaDataRepository.java:551)
        at org.apache.openjpa.meta.MetaDataRepository.getMetaData(MetaDataRepository.java:304)
        at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:241)
        at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:212)
        at org.apache.openjpa.enhance.PCEnhancer.<init>(PCEnhancer.java:182)
        at org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:121)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:311)
        at org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:229)
        at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:191)
        at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
        at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192)
        at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:145)
        at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:56)
        at org.permacode.patternrepo.jpa.ProgrammaticTransactionIntegrationTest.test(ProgrammaticTransactionIntegrationTest.java:71)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:585)
        at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99)
        at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81)
        at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
        at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75)
        at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45)
        at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71)
        at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35)
        at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42)
        at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34)
        at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52)
        at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
        at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)



> configuration for openjpa.jdbc.Schemas not applied to SQL
> ---------------------------------------------------------
>
>                 Key: OPENJPA-483
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-483
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.1.0
>         Environment: Java JDK 1.5.0_12, Linux, Hypersonic DB
>            Reporter: Adam Hardy
>         Attachments: schemabug.zip
>
>
> OpenJPA should be able to see and access schemas but doesn't.
> I configured this with openjpa.jdbc.Schema=DEV (my schema name)
> I also tried putting the schema name everywhere possible in the metadata, i.e. in the <schema>DEV</schema> tags and in table tags, and in:
>   <persistence-unit-metadata>
>     <xml-mapping-metadata-complete />
>     <persistence-unit-defaults>
>       <schema>DEV</schema>
>     </persistence-unit-defaults>
>   </persistence-unit-metadata>
> I will include a zipped up test project illustrating the problem.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

JIRA jira@apache.org

[jira] Updated: (OPENJPA-483) configuration for openjpa.jdbc.Schemas not applied to SQL

Reply Threaded More More options
Print post
Permalink
In reply to this post by JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/OPENJPA-483?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Hardy updated OPENJPA-483:
-------------------------------

    Attachment: schemabug2.zip

Discovered that it is Hypersonic only.

The attached project allows you to switch between Hypersonic and H2 by changing org.permacode.patternrepo.jpa.JpaTest line 38, which demonstrates that it works for H2.

> configuration for openjpa.jdbc.Schemas not applied to SQL
> ---------------------------------------------------------
>
>                 Key: OPENJPA-483
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-483
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.1.0
>         Environment: Java JDK 1.5.0_12, Linux, Hypersonic DB
>            Reporter: Adam Hardy
>         Attachments: schemabug.zip, schemabug2.zip
>
>
> OpenJPA should be able to see and access schemas but doesn't.
> I configured this with openjpa.jdbc.Schema=DEV (my schema name)
> I also tried putting the schema name everywhere possible in the metadata, i.e. in the <schema>DEV</schema> tags and in table tags, and in:
>   <persistence-unit-metadata>
>     <xml-mapping-metadata-complete />
>     <persistence-unit-defaults>
>       <schema>DEV</schema>
>     </persistence-unit-defaults>
>   </persistence-unit-metadata>
> I will include a zipped up test project illustrating the problem.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

JIRA jira@apache.org

[jira] Updated: (OPENJPA-483) config for openjpa.jdbc.Schemas not applied to SQL (HSQL)

Reply Threaded More More options
Print post
Permalink
In reply to this post by JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/OPENJPA-483?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Adam Hardy updated OPENJPA-483:
-------------------------------

    Summary: config for openjpa.jdbc.Schemas not applied to SQL (HSQL)  (was: configuration for openjpa.jdbc.Schemas not applied to SQL)

> config for openjpa.jdbc.Schemas not applied to SQL (HSQL)
> ---------------------------------------------------------
>
>                 Key: OPENJPA-483
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-483
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.1.0
>         Environment: Java JDK 1.5.0_12, Linux, Hypersonic DB
>            Reporter: Adam Hardy
>         Attachments: schemabug.zip, schemabug2.zip
>
>
> OpenJPA should be able to see and access schemas but doesn't.
> I configured this with openjpa.jdbc.Schema=DEV (my schema name)
> I also tried putting the schema name everywhere possible in the metadata, i.e. in the <schema>DEV</schema> tags and in table tags, and in:
>   <persistence-unit-metadata>
>     <xml-mapping-metadata-complete />
>     <persistence-unit-defaults>
>       <schema>DEV</schema>
>     </persistence-unit-defaults>
>   </persistence-unit-metadata>
> I will include a zipped up test project illustrating the problem.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

JIRA jira@apache.org

[jira] Commented: (OPENJPA-483) config for openjpa.jdbc.Schemas not applied to SQL (HSQL)

Reply Threaded More More options
Print post
Permalink
In reply to this post by JIRA jira@apache.org

    [ https://issues.apache.org/jira/browse/OPENJPA-483?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12770963#action_12770963 ]

David Beer commented on OPENJPA-483:
------------------------------------

I am experiencing the same issue with openjpa 1.2.1

It seems that when you connect for the first time that openjpa seems to ignore the schema property.  openjpa then proceeds to create the tables in the default schema PUBLIC.

After some discussion on the mailing list, Kevin Sutter recons this may be to do with the DBDictionary not having the righ methods to detect the openjpa schema property.


> config for openjpa.jdbc.Schemas not applied to SQL (HSQL)
> ---------------------------------------------------------
>
>                 Key: OPENJPA-483
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-483
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.1.0
>         Environment: Java JDK 1.5.0_12, Linux, Hypersonic DB
>            Reporter: Adam Hardy
>         Attachments: schemabug.zip, schemabug2.zip
>
>
> OpenJPA should be able to see and access schemas but doesn't.
> I configured this with openjpa.jdbc.Schema=DEV (my schema name)
> I also tried putting the schema name everywhere possible in the metadata, i.e. in the <schema>DEV</schema> tags and in table tags, and in:
>   <persistence-unit-metadata>
>     <xml-mapping-metadata-complete />
>     <persistence-unit-defaults>
>       <schema>DEV</schema>
>     </persistence-unit-defaults>
>   </persistence-unit-metadata>
> I will include a zipped up test project illustrating the problem.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

JIRA jira@apache.org

[jira] Updated: (OPENJPA-483) config for openjpa.jdbc.Schemas not applied to SQL (HSQL)

Reply Threaded More More options
Print post
Permalink
In reply to this post by JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/OPENJPA-483?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

David Beer updated OPENJPA-483:
-------------------------------

    Attachment: HSQLDB-openjpa Test.zip

test project showing schema bug with openjpa 1.2.1 and HSQLDB.

just run ant test. This will attempt to create a db and connect to it. Then connect to the nely created testdb via the HSQL database manager.

> config for openjpa.jdbc.Schemas not applied to SQL (HSQL)
> ---------------------------------------------------------
>
>                 Key: OPENJPA-483
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-483
>             Project: OpenJPA
>          Issue Type: Bug
>    Affects Versions: 1.1.0
>         Environment: Java JDK 1.5.0_12, Linux, Hypersonic DB
>            Reporter: Adam Hardy
>         Attachments: HSQLDB-openjpa Test.zip, schemabug.zip, schemabug2.zip
>
>
> OpenJPA should be able to see and access schemas but doesn't.
> I configured this with openjpa.jdbc.Schema=DEV (my schema name)
> I also tried putting the schema name everywhere possible in the metadata, i.e. in the <schema>DEV</schema> tags and in table tags, and in:
>   <persistence-unit-metadata>
>     <xml-mapping-metadata-complete />
>     <persistence-unit-defaults>
>       <schema>DEV</schema>
>     </persistence-unit-defaults>
>   </persistence-unit-metadata>
> I will include a zipped up test project illustrating the problem.

--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.