title: JOOQ generated classes have schema defaulted to PUBLIC
body: <p>This is a follow up question to this <a href="https://stackoverflow.com/questions/43760284/jooq-codegen-with-jpadatabase-not-working">SO Question</a>. I am using jooq codegen for auto generation of jooq classes from jpa entities. I am planning to use jooq as a SQL query builder and execute the actual queries with JPA EntityManager. But jooq is generating the tables from entities with schema defaulted to PUBLIC.</p>
  
  <p>For example if my query has to be</p>
  
  <pre class="lang-sql prettyprint-override"><code>select SCHEMA_A.colA, SCHEMA_A.colB from SCHEMA_A.tableA;
  </code></pre>
  
  <p>jooq is generating </p>
  
  <pre class="lang-sql prettyprint-override"><code>select PUBLIC.colA, PUBLIC.colB from PUBLIC.tableA;
  </code></pre>
  
  <p>This is making the query fail when I fire the following query because the schema is invalid.</p>
  
  <pre class="lang-java prettyprint-override"><code>entityManager.createNativeQuery(sqlString).getResultList();
  </code></pre>
  
  <p>What configuration do I need to add to make the autogenerated code contain the actual schema name?</p>
  
  <p>Codegen:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;build&gt;
      &lt;plugins&gt;
          &lt;plugin&gt;
              &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
              &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
              &lt;configuration&gt;
                  &lt;source&gt;1.8&lt;/source&gt;
                  &lt;target&gt;1.8&lt;/target&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
  
          &lt;plugin&gt;
              &lt;groupId&gt;org.jooq&lt;/groupId&gt;
              &lt;artifactId&gt;jooq-codegen-maven&lt;/artifactId&gt;
              &lt;version&gt;3.9.1&lt;/version&gt;
  
              &lt;!-- The plugin should hook into the generate goal --&gt;
              &lt;executions&gt;
                  &lt;execution&gt;
                      &lt;phase&gt;generate-sources&lt;/phase&gt;
                      &lt;goals&gt;
                          &lt;goal&gt;generate&lt;/goal&gt;
                      &lt;/goals&gt;
                  &lt;/execution&gt;
              &lt;/executions&gt;
  
              &lt;dependencies&gt;
                  &lt;dependency&gt;
                      &lt;groupId&gt;org.jooq&lt;/groupId&gt;
                      &lt;artifactId&gt;jooq-meta-extensions&lt;/artifactId&gt;
                      &lt;version&gt;3.9.1&lt;/version&gt;
                  &lt;/dependency&gt;
  
                  &lt;dependency&gt;
                      &lt;groupId&gt;com.yaswanth&lt;/groupId&gt;
                      &lt;artifactId&gt;domain&lt;/artifactId&gt;
                      &lt;version&gt;${project.version}&lt;/version&gt;
                  &lt;/dependency&gt;
              &lt;/dependencies&gt;
  
              &lt;configuration&gt;
  
                  &lt;!-- Generator parameters --&gt;
                  &lt;generator&gt;
  
                      &lt;database&gt;
                          &lt;name&gt;org.jooq.util.jpa.JPADatabase&lt;/name&gt;
                          &lt;outputSchema&gt;[SCHEMA_A]&lt;/outputSchema&gt;
                          &lt;properties&gt;
                              &lt;!-- A comma separated list of Java packages, that contain your entities --&gt;
                              &lt;property&gt;
                                  &lt;key&gt;packages&lt;/key&gt;
                                  &lt;value&gt;com.yaswanth.domain.entity&lt;/value&gt;
                              &lt;/property&gt;
                          &lt;/properties&gt;
                      &lt;/database&gt;
  
                      &lt;target&gt;
                          &lt;packageName&gt;com.yaswanth.domain.entity.jooq&lt;/packageName&gt;
                          &lt;directory&gt;target/generated-sources/jooq&lt;/directory&gt;
                      &lt;/target&gt;
                  &lt;/generator&gt;
              &lt;/configuration&gt;
          &lt;/plugin&gt;
      &lt;/plugins&gt;
  &lt;/build&gt;
  </code></pre>
  
  <p>jooq spring beans config</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;bean id="dslContext" class="org.jooq.impl.DefaultDSLContext"&gt;
      &lt;constructor-arg ref="jooqConfig" /&gt;
  &lt;/bean&gt;
  
  &lt;bean id="jooqConfig" class="org.jooq.impl.DefaultConfiguration"&gt;
      &lt;property name="SQLDialect" value="MYSQL" /&gt;
      &lt;property name="dataSource" ref="myDataSource" /&gt;
      &lt;property name="settings" ref="settings"/&gt;
  &lt;/bean&gt;
  
  &lt;bean id="settings" class="org.jooq.conf.Settings"&gt;
      &lt;property name="renderSchema" value="true" /&gt;
  &lt;/bean&gt;
  </code></pre>