MetadataExporter should provide option to override output schema #1473

holgerstolzenberg opened this Issue Aug 12, 2015 · 3 comments


None yet

2 participants


We are using Oracle in this case. We create our Q* classes via Gradle + AntMetadataExplorer without JPA model. When running the code generator, the schema rendered into the Q* classes in the end is the username.

In our use case that is a bit problematic. Let´s assume we have a semantical schema APPDATA. The codegen runs against a local dev vm, where we have multiple schemas, e.g. APPDATA_STAGE and APPDATA_INTEGRATION_TEST.

For sure I can take one of these and remap it at runtime with Configuration.registerSchemaOverride(…), but then the mapping would be:


It would be nice to have a schema override setting within MetadataExporter so that I can create the Q* classes with a semantically correct schema name, so that at runtime may mapping would look like:


As a little motivation :-) jOOQ code generator provides this feature.


Thanks for the issue! That functionality is already there. Somehow I just missed to document it properly.

@timowest timowest added the progress label Aug 18, 2015

Oh nice. In the meantime, will it help to dig into AntMetadataExplorer sources. How is the config property called?


Having a look at your commit 96c063a, it seems that this rename functionality is only related to the maven plugin, am I right?

We are creating the Q* classes the following way:

def url = property('flyway.url');
def pass = property('flyway.password')
def driver = 'oracle.jdbc.OracleDriver'
def targetPath = projectDir.absolutePath + File.separator + 'src/generated/java'

task generateQuerydsl() {
  doFirst {
    logging.captureStandardOutput LogLevel.INFO
    println "[Querydsl]: $url"

  doLast {
    ant {
      taskdef(name: 'generateQuerydsl',
          classname: 'com.querydsl.sql.codegen.ant.AntMetaDataExporter',
          classpath: configurations.compile.asPath)

      generateQuerydsl(jdbcDriver: driver,
          jdbcUrl: url,
          jdbcUser: 'the_user', jdbcPassword: pass,
          packageName: 'com.any.package',
          targetFolder: targetPath,
          schemaPattern: 'THE_SCHEMA',
          exportAll: true

Digging into AntMetadataExplorer (4.0.3), it seems there is no way to register these rename mappings.

@timowest timowest closed this in #1488 Aug 28, 2015
@timowest timowest added this to the 4.0.4 milestone Aug 28, 2015
@timowest timowest removed the progress label Aug 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment