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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:58:25+00:00 2026-05-23T22:58:25+00:00

Our application has a need to share an existing database table with another locally

  • 0

Our application has a need to share an existing database table with another locally running application, and, so, I wish to refer to this table but skip generating the DDL for it. I also hoped to define the table in the application’s schema as an alias or MySQL merge table, but I can add that to a manual script that will run before the generated schema script.

How can I specify that the create and alter table DDL for the shared_schema table are omitted from the myapp-schema-ddl.sql output?

From commons/src/main/java/com/company/shared/SharedSuperEntity.java:

@Entity
@Table(name="shared_entity", catalog = "shared_schema")
@Inheritance(strategy = InheritanceType.JOINED)
public class SharedSuperEntity {
    // fields, etc...
}

From myapp/src/main/java/com/company/shared/SharedSuperEntity.java:

@Entity
@Table(name="local_entity", catalog = "local_schema")
public class LocalEntity extends SharedSuperEntity {
    // fields, etc...
}

From myapp/src/main/resources/META_INF/persistence.xml:

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="MyAppPU" transaction-type="JTA">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <jta-data-source>java:/LocalDS</jta-data-source>
    <class>com.company.shared.SharedSuperEntity</class>
    <class>com.company.myapp.LocalEntity</class>
    <exclude-unlisted-classes>true</exclude-unlisted-classes>
    <shared-cache-mode>NONE</shared-cache-mode>
    <validation-mode>AUTO</validation-mode>
    <properties>
        <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup" />
        <property name="hibernate.show_sql" value="false" />
        <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect" />
        <property name="hibernate.bytecode.use_reflection_optimizer" value="false" />
        <property name="hibernate.default_batch_fetch_size" value="4" />
        <property name="hibernate.default_entity_mode" value="pojo" />
        <property name="hibernate.generate_statistics" value="false" />
        <property name="hibernate.jdbc.batch_size" value="0" />
        <property name="hibernate.jdbc.batch_versioned_data" value="true" />
        <property name="hibernate.jdbc.fetch_size" value="0" />
        <property name="hibernate.jdbc.use_get_generated_keys" value="false" />
        <property name="hibernate.jdbc.use_scrollable_resultset" value="false" />
        <property name="hibernate.jdbc.use_streams_for_binary" value="false" />
        <property name="hibernate.hibernate.max_fetch_depth" value="3" />
        <property name="hibernate.order_updates" value="true" />
        <property name="hibernate.query.substitutions" value="true 1, false 0, yes 'Y', no 'N'" />
        <property name="hibernate.use_identifer_rollback" value="true" />
        <property name="hibernate.use_outer_join" value="false" />
        <property name="hibernate.use_sql_comments" value="false" />
        <property name="hibernate.id.new_generator_mappings" value="true" />
    </properties>
</persistence-unit>

From within myapp/pom.xml:

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>hibernate3-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <components>
                    <component>
                        <name>hbm2ddl</name>
                        <implementation>jpaconfiguration</implementation>
                    </component>
                </components>
                <componentProperties>
                    <persistenceunit>MyAppPU</persistenceunit>
                    <outputfilename>myapp-schema-ddl.sql</outputfilename>
                    <drop>false</drop>
                    <create>true</create>
                    <export>false</export>
                    <format>true</format>
                    <jdk5>true</jdk5>
                </componentProperties>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-core</artifactId>
                    <version>3.6.0.Final</version>
                    <scope>compile</scope>
                </dependency>
                <dependency>
                    <groupId>org.hibernate</groupId>
                    <artifactId>hibernate-entitymanager</artifactId>
                    <version>3.6.0.Final</version>
                    <scope>compile</scope>
                </dependency>
                <dependency>
                    <groupId>org.hibernate.javax.persistence</groupId>
                    <artifactId>hibernate-jpa-2.0-api</artifactId>
                    <version>1.0.0.Final</version>
                    <scope>compile</scope>
                </dependency>
                <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <version>5.1.16</version>
                    <type>jar</type>
                    <scope>compile</scope>
                </dependency>
            </dependencies>
        </plugin>
  • 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-23T22:58:26+00:00Added an answer on May 23, 2026 at 10:58 pm

    I don’t think Hibernate supports that directly. You could make two config files: one that lists all the mapped classes for runtime and one that omits the offending class for schema generation. Otherwise, you might look at some kind of post-processing, like a sed script, to remove the DDL after the fact.

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

Sidebar

Related Questions

Our application runs off MySQL, but a client has another application that requires SQL.
Our Java application has about 100 classes mapped to a database (SQL Server or
Our application has a table which stores all transactions records of clients in one
In our application we need to check if a given string has only numbers
Our application has a file format similar to the OpenDocument file format (see http://en.wikipedia.org/wiki/OpenDocument
Our application has a service layer and a DAO layer, written as Spring beans.
Our application has many controls that are created dynamically. For example, a navigation pane
Our application has a couple of shell scripts that are called from web-based Oracle
Our WinForms application has been reported to occasionally just close on its own. It
After our Ruby on Rails application has run for a while, it starts throwing

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.