Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
3.1.0
-
None
-
None
-
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...".