Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8795817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:28:24+00:00 2026-06-13T23:28:24+00:00

I am trying to add the sql generator goal to my openjpa plugin. I

  • 0

I am trying to add the sql generator goal to my openjpa plugin. I use OpenJPA 2.2.0. I have the jpa enhancer working with the following relevant part of the pom.sql file:

<build>

    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.openjpa</groupId>
                <artifactId>openjpa-maven-plugin</artifactId>
                <version>${org.apache.openjpa.version}</version>
                <configuration>
                    <includes>org/someorg/models/local/*.class</includes>

                    <addDefaultConstructor>true</addDefaultConstructor>
                    <connectionDriverName>org.postgresql.Driver</connectionDriverName>
                    <enforcePropertyRestrictions>true</enforcePropertyRestrictions>
                    <sqlFile>src/main/resources/sql/create.sql</sqlFile>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>

    <plugins>

        <plugin>
            <groupId>org.apache.openjpa</groupId>
            <artifactId>openjpa-maven-plugin</artifactId>
            <version>${org.apache.openjpa.version}</version>

            <executions>
                <execution>
                    <id>enhancer</id>
                    <phase>process-classes</phase>
                    <goals>
                        <goal>enhance</goal>
                    </goals>
                </execution>                    
            </executions>
            <dependencies>
                <dependency>
                    <groupId>org.apache.openjpa</groupId>
                    <artifactId>openjpa</artifactId>
                    <!-- set the version to be the same as the level in your runtime -->
                    <version>${org.apache.openjpa.version}</version>
                </dependency>
            </dependencies>
        </plugin>
</plugins>

As I then try to add the following to the executions part of the openjpa plugin:

<execution>
    <id>sql</id>
    <phase>generate-resources</phase>
    <goals>
        <goal>sql</goal>
    </goals>
</execution>

I get the following error while executing mvn -e install command:
http://pastebin.com/TENgXezJ

A shorter version from running without the -e switch:

[ERROR] 
Failed to execute goal org.apache.openjpa:openjpa-maven-plugin:2.2.0:sql(sql) on project batchpoc: 
Execution sql of goal org.apache.openjpa:openjpa-maven-plugin:2.2.0:sql failed: MetaDataFactory could not be configured 
(conf.newMetaDataFactoryInstance() returned null). 
This might mean that no configuration properties were found. 
Ensure that you have a META-INF/persistence.xml file, that it is available in your classpath, 
or that the properties file you are using for configuration is available. 
If you are using Ant, please see the <properties> or <propertiesFile> attributes of the task's nested <config> element. This can also occur if your OpenJPA distribution jars are corrupt, 
or if your security policy is overly strict. -> [Help 1]
[ERROR]

What am I missing?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:28:25+00:00Added an answer on June 13, 2026 at 11:28 pm

    OK, so I solved it myself. Apparently the trick is not inside the pom.xml but rather in the persistence unit definition in persistence.xml

    It is really easy. I just added

    <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema"/>
    

    And I was done.

    Apparently for OpenJPA you also need to list the entity classes you wish to have generated according to the information here:
    http://planet.jboss.org/post/generate_a_database_schema_with_openjpa_and_hibernate_on_jboss_as_7

    As I had already listed my classes previously I didn’t recognize this as a needed step.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to add a persistent SQL where clause in SQLalchimy. Basically I have
I am trying to use some dynamic sql. I have generated over 100 parameters,
I've encountered this problem (while trying to add SQL Server Database (.mdf) file to
I'm trying to programmatically add an Execute SQL task from within a script task
I am trying to add a CASE statement to the end of my SQL
Hi every One I am trying to add column in Mysql. My Sql Query
I'm trying to create a simple Add-On for SQL Server 2008; it is simply
I am trying to create an add-in by using the article below http://blogs.microsoft.co.il/blogs/shair/archive/2008/07/28/how-to-create-sql-server-management-studio-addin.aspx I
The goal: I'm trying to use the new Entity Framework 4.1 DbContext API (using
I'm trying to learn to write a WordPress plugin by setting myself a goal

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.