Devskiller / jpa2ddl

JPA Schema Generator Plugin
Apache License 2.0
110 stars 33 forks source link

Schema PROD not found; SQL statement #37

Closed sebastienvermeille closed 3 years ago

sebastienvermeille commented 3 years ago

Hi I try to use this plugin which is really interesting but unfortunately I get an error with a very simple entity:

[ERROR] Failed to execute goal com.devskiller.jpa2ddl:jpa2ddl-maven-plugin:0.9.12:generate (default-generate) on project persistence: Schema "PROD" not found; SQL statement:
[ERROR]
[ERROR]     create table prod.User (
[ERROR]        id uuid not null,
[ERROR]         createdAt timestamp not null,
[ERROR]         email varchar(255),
[ERROR]         hashedPassword varchar(255),
[ERROR]         primary key (id)
[ERROR]     );
[ERROR]  [90079-196]
[ERROR] -> [Help 1]

Plugin config:

 <plugin>
        <artifactId>jpa2ddl-maven-plugin</artifactId>
        <configuration>
          <action>UPDATE</action>
          <delimiter>;</delimiter>
          <formatOutput>true</formatOutput>
          <jpaProperties>
            <property>
              <name>hibernate.dialect</name>
              <value>org.hibernate.dialect.PostgreSQL10Dialect</value>
            </property>
            <property>
              <name>hibernate.default_schema</name>
              <value>public</value>
            </property>
          </jpaProperties>
          <outputPath>${basedir}/src/main/resources/db/migration/</outputPath>
          <packages>
            <package>ch.sbeex.rendezvous.persistence.entity</package>
          </packages>
          <skipSequences>true</skipSequences>
        </configuration>
        <extensions>true</extensions>
        <groupId>com.devskiller.jpa2ddl</groupId> <!-- required to run automatically -->
        <version>0.9.12</version>
      </plugin>

so 1) as we can see in the log it generate PROD as an hardcoded value even if I choose "public" as default schema and 2) what is this error ? not sure to fully understand it.

Thank you in advance for your guidance 👍

jkubrynski commented 3 years ago

@sebastienvermeille isn't it a code from our sample project? If yes there is a hardcoded "prod" schema.

sebastienvermeille commented 3 years ago

no it is not that's the problem..

jkubrynski commented 3 years ago

@sebastienvermeille what hibernate version do you use?

jkubrynski commented 3 years ago

I've verified this case and I have such output:

    create table public.User (
       id int8 not null,
        date timestamp,
        email varchar(255),
        primary key (id)
    );

Please provide us with the https://stackoverflow.com/help/minimal-reproducible-example or a PR with the testcase so we can analyze it on our usecase