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 3624328
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T23:29:38+00:00 2026-05-18T23:29:38+00:00

I am setting up maven to take annotated java classes and produce some DDL

  • 0

I am setting up maven to take annotated java classes and produce some DDL which varies depending on the database. Is there a better way to do this? It seems like I should be able to filter the input to the hbm2ddl plugin (as part of a pipeline) rather than tell it to operate on the output of resource filtering (which I then must filter out of my final jar).

I am filtering my hibernate.cfg.xml file to substitute environment properties based on the local developer’s setup:

  <build>
    <filters>
      <filter>${user.home}/datamodel-build.properties</filter>
    </filters>
    <resources><resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
    </resource></resources>
  </build>

Then I run hbm2ddl on the output

<plugin>
 <groupId>org.codehaus.mojo</groupId>
 <artifactId>hibernate3-maven-plugin</artifactId>
  ...
 <configuration>
   <componentProperties>
   <configurationfile>target/classes/com/myOrg/datamodel/hibernate.cfg.xml</configurationfile>
</plugin>

I then must filter out the hibernate.cfg.xml from my production jar since I don’t want to ship anything related to my internal dev environment.

  • 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-05-18T23:29:39+00:00Added an answer on May 18, 2026 at 11:29 pm

    I have this same issue and here is how I solved it. I use have a separate database.properties file that holds the connection details and I don’t filter any of my XML files.

    This seperate database.properties file gets filtered, but since it is a test resource located in /src/main/test it doesn’t get put into the final artifact. I then tell hbm2ddl where to find it as follows:

                <configuration>
                    <components>
                        <component>
                            <name>hbm2ddl</name>
                            <implementation>jpaconfiguration</implementation>
                        </component>
                    </components>
                    <componentProperties>
                        <propertyfile>src/test/resources/database.properties</propertyfile>
                        <!-- Gives the name of the persistence unit as defined in persistence.xml -->
                        <persistenceunit>myapp-core</persistenceunit>
                        <!-- Tells the plugin to send the output to a file -->
                        <outputfilename>create-${database.vendor}-schema.sql</outputfilename>
                        <!-- Pretty Format SQL Code -->
                        <format>true</format>
                        <!-- Do not create tables automatically - other plug-ins will handle that -->
                        <export>false</export>
                        <!-- Do not print the DDL to the console -->
                        <console>false</console>
                    </componentProperties>
                </configuration>
    

    Hope it helps anyway….

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

Sidebar

Related Questions

Most of our projects are built with Maven, and some of them use classes
What do people think is the best way of setting up a Java, maven-2
When setting up a rollover effect in HTML, are there any benefits (or pitfalls)
I'm setting up a maven build, and the destination server needs to be specified
I have a problem setting up my maven j2me project that I created in
I understand that part of the appeal of setting up a Maven mirror, such
I'm setting up Hudson to use the batch-task plugin to do maven releases to
I wonder whether I can setting up a private maven repository based on my
I'm using Maven 2 and Hibernate for a Java web app. I have a
How would you collaborate on a Maven project with another developer, without setting up

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.