2

Running on Wildly 8.2.0.Final. I get the following error when trying to generate a database schema from a script.

Caused by: javax.persistence.PersistenceException: Schema generation configuration indicated to include CREATE scripts, but no script was specified

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"


 xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="
        http://xmlns.jcp.org/xml/ns/persistence
        http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
   <persistence-unit name="com.mycompany_mavenFlowChartDB5_war_1.0-SNAPSHOTPU" transaction-type="JTA">
    <jta-data-source>java:jboss/datasources/postgresql</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
      <property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
      <property name=""/>
      <property name="javax.persistence.schema-generation.create-source" value="script"/>
      <property name="javax.persistence.schema-generation.drop-source" value="script"/>
      <property name="javax.persistence.schema-generation.scripts.action" value="none"/>
      <property name="javax.persistence.schema-generation.scripts.drop-target" value="META-INF/drop-script.sql"/>
      <property name="javax.persistence.schema-generation.scripts.create-target" value="META-INF/create-script.sql"/>
    </properties>
  </persistence-unit>
</persistence>

Where the create script is located: /src/main/resources/META-INF/create-script.sql

Thanks in advance!

1 Answer 1

3

The Wildfly persistence schema generator gui creates incorrect property names for the drop and create targets.

The correct property names are

<property name="javax.persistence.schema-generation.drop-script-source" value="META-INF/drop-script.sql"/>
        <property name="javax.persistence.schema-generation.create-script-source" value="META-INF/create-script.sql"/>

change create-script to create-script-source and drop-script to drop-script-source

source: https://github.com/hantsy/ee7-sandbox

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.