Uploaded image for project: 'OpenJPA'
  1. OpenJPA
  2. OPENJPA-2839

OpenJPA+H2 is finding USERS table from INFORMATION_SCHEMA

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.1.0
    • Fix Version/s: None
    • Component/s: jpa
    • Labels:
      None
    • Environment:
      Java 11, OpenJPA 3.1.0 (from TomEE), H2 1.4.200

      Description

      With Entity table named USERS, OpenJPA+H2 is incorrectly detecting that table exists because it finds INFORMATION_SCHEMA.USERS.

       

      Using H2 as JDBC driver and metadata-only DDL schema generation:

      <property name="javax.persistence.schema-generation.database.action" value="drop-and-create" />
      
      <property name="javax.persistence.sql-load-script-source" value="initial-data.sql" />

      The connection string is jdbc:h2:mem:testdb.

       

      The Entity table is named "Users" but OpenJPA misdetects that the table exists (it searches in the INFORMATION_SCHEMA as well, it seems), and so does not send "CREATE TABLE..".

      Instead it sends "ALTER TABLE...". In H2 this targets the PUBLIC schema and so will fail as the "Users" table does not exist in the PUBLIC schema.

      In contrast, hibernate correctly detects that the table does not exist, and sends "CREATE TABLE...".

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              spchan CHAN Shih-Ping
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: