Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to repeat a particular execution multiple times
    primarykey
    data
    text
    <p>The following snippet generates create / drop sql for a particular database, whenever there is a modification to JPA entity classes.</p> <p>How do I perform something equivalent of a 'for' operation where-in the following code can be used to generate sql for all supported databases (e.g. H2, MySQL, Postgres)</p> <p>Currently I have to modify db.groupId, db.artifactId, db.driver.version everytime to generate the sql files</p> <pre><code> &lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;hibernate3-maven-plugin&lt;/artifactId&gt; &lt;version&gt;${hibernate3-maven-plugin.version}&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;id&gt;create schema&lt;/id&gt; &lt;phase&gt;process-test-resources&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;hbm2ddl&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;componentProperties&gt; &lt;persistenceunit&gt;${app.module}&lt;/persistenceunit&gt; &lt;drop&gt;false&lt;/drop&gt; &lt;create&gt;true&lt;/create&gt; &lt;outputfilename&gt;${app.sql}-create.sql&lt;/outputfilename&gt; &lt;/componentProperties&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;execution&gt; &lt;id&gt;drop schema&lt;/id&gt; &lt;phase&gt;process-test-resources&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;hbm2ddl&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;componentProperties&gt; &lt;persistenceunit&gt;${app.module}&lt;/persistenceunit&gt; &lt;drop&gt;true&lt;/drop&gt; &lt;create&gt;false&lt;/create&gt; &lt;outputfilename&gt;${app.sql}-drop.sql&lt;/outputfilename&gt; &lt;/componentProperties&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;dependencies&gt; &lt;dependency&gt; &lt;groupId&gt;org.hibernate&lt;/groupId&gt; &lt;artifactId&gt;hibernate-core&lt;/artifactId&gt; &lt;version&gt;${hibernate-core.version}&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.slf4j&lt;/groupId&gt; &lt;artifactId&gt;slf4j-api&lt;/artifactId&gt; &lt;version&gt;${slf4j-api.version}&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.slf4j&lt;/groupId&gt; &lt;artifactId&gt;slf4j-nop&lt;/artifactId&gt; &lt;version&gt;${slf4j-nop.version}&lt;/version&gt; &lt;/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;${db.groupId}&lt;/groupId&gt; &lt;artifactId&gt;${db.artifactId}&lt;/artifactId&gt; &lt;version&gt;${db.driver.version}&lt;/version&gt; &lt;/dependency&gt; &lt;/dependencies&gt; &lt;configuration&gt; &lt;components&gt; &lt;component&gt; &lt;name&gt;hbm2cfgxml&lt;/name&gt; &lt;implementation&gt;annotationconfiguration&lt;/implementation&gt; &lt;/component&gt; &lt;component&gt; &lt;name&gt;hbm2dao&lt;/name&gt; &lt;implementation&gt;annotationconfiguration&lt;/implementation&gt; &lt;/component&gt; &lt;component&gt; &lt;name&gt;hbm2ddl&lt;/name&gt; &lt;implementation&gt;jpaconfiguration&lt;/implementation&gt; &lt;outputDirectory&gt;src/main/sql&lt;/outputDirectory&gt; &lt;/component&gt; &lt;component&gt; &lt;name&gt;hbm2doc&lt;/name&gt; &lt;implementation&gt;annotationconfiguration&lt;/implementation&gt; &lt;/component&gt; &lt;component&gt; &lt;name&gt;hbm2hbmxml&lt;/name&gt; &lt;implementation&gt;annotationconfiguration&lt;/implementation&gt; &lt;/component&gt; &lt;component&gt; &lt;name&gt;hbm2java&lt;/name&gt; &lt;implementation&gt;annotationconfiguration&lt;/implementation&gt; &lt;/component&gt; &lt;component&gt; &lt;name&gt;hbm2template&lt;/name&gt; &lt;implementation&gt;annotationconfiguration&lt;/implementation&gt; &lt;/component&gt; &lt;/components&gt; &lt;/configuration&gt; &lt;/plugin&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload