blob: 8d6a676ff8d477cdba805bce429b71d255aa6dd6 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- Generated by Apache Maven Doxia Site Renderer 1.8.1 from target/generated-site/xdoc/sql-mojo.xml at 06 Sep 2020 22:02 CEST -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>OpenJPA Maven Plugin &#x2013; openjpa:sql</title>
<style type="text/css" media="all">
@import url("./css/maven-base.css");
@import url("./css/maven-theme.css");
@import url("./css/site.css");
</style>
<link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
<meta http-equiv="Content-Language" content="en" />
</head>
<body class="composite">
<div id="banner">
<div id="bannerLeft">
OpenJPA
</div>
<div class="clear">
<hr/>
</div>
</div>
<div id="breadcrumbs">
<div class="xleft">
<span id="publishDate">Last Published: 06 Sep 2020 22:02 CEST</span>
&nbsp;| <span id="projectVersion">Version: 3.1.3-SNAPSHOT</span>
</div>
<div class="xright"> </div>
<div class="clear">
<hr/>
</div>
</div>
<div id="leftColumn">
<div id="navcolumn">
<h5>Overview</h5>
<ul>
<li class="none"><a href="index.html" title="Introduction">Introduction</a></li>
<li class="none"><a href="usage.html" title="Usage">Usage</a></li>
<li class="none"><a href="plugin-info.html" title="Goals">Goals</a></li>
</ul>
<h5>Examples</h5>
<ul>
<li class="none"><a href="examples/enhance.html" title="Enhance">Enhance</a></li>
<li class="none"><a href="examples/sql.html" title="SQL">SQL</a></li>
<li class="none"><a href="examples/schema.html" title="Schema">Schema</a></li>
<li class="none"><a href="examples/testenhance.html" title="TestEnhance">TestEnhance</a></li>
</ul>
<a href="http://maven.apache.org/" title="Built by Maven" class="poweredBy">
<img class="poweredBy" alt="Built by Maven" src="./images/logos/maven-feather.png" />
</a>
</div>
</div>
<div id="bodyColumn">
<div id="contentBox">
<div class="section">
<h2><a name="openjpa:sql"></a>openjpa:sql</h2>
<p><b>Full name</b>:</p>
<p>org.apache.openjpa:openjpa-maven-plugin:3.1.3-SNAPSHOT:sql</p>
<p><b>Description</b>:</p>
<div>Executes the SQL generation via the OpenJPA MappingTool.</div>
<p><b>Attributes</b>:</p>
<ul>
<li>Requires a Maven project to be executed.</li>
<li>Requires dependency resolution of artifacts in scope: <tt>compile</tt>.</li>
<li>Since version: <tt>1.0</tt>.</li>
<li>Binds by default to the <a class="externalLink" href="http://maven.apache.org/ref/current/maven-core/lifecycles.html">lifecycle phase</a>: <tt>process-classes</tt>.</li>
</ul>
<div class="section">
<h3><a name="Required_Parameters"></a>Required Parameters</h3>
<table class="bodyTable" border="0">
<tr class="a">
<th>Name</th>
<th>Type</th>
<th>Since</th>
<th>Description</th>
</tr>
<tr class="b">
<td><tt><a href="#classes">&lt;classes&gt;</a></tt></td>
<td><tt>File</tt></td>
<td><tt>1.0</tt></td>
<td>Location where <tt>persistence-enabled</tt> classes are
located.<br /><b>Default value is</b>: <tt>${project.build.outputDirectory}</tt>.<br /><b>User property is</b>: <tt>openjpa.classes</tt>.<br /></td>
</tr>
<tr class="a">
<td><tt><a href="#forceMojoExecution">&lt;forceMojoExecution&gt;</a></tt></td>
<td><tt>boolean</tt></td>
<td><tt>1.0</tt></td>
<td>Setting this parameter to <tt>true</tt> will force the
execution of this mojo, even if it would get skipped usually.<br /><b>Default value is</b>: <tt>false</tt>.<br /><b>User property is</b>: <tt>forceOpenJpaExecution</tt>.<br /></td>
</tr>
<tr class="b">
<td><tt><a href="#workDir">&lt;workDir&gt;</a></tt></td>
<td><tt>File</tt></td>
<td><tt>1.0</tt></td>
<td>The working directory for putting persistence.xml and other stuff
into if we need to.<br /><b>Default value is</b>: <tt>${project.build.directory}/openjpa-work</tt>.<br /><b>User property is</b>: <tt>openjpa.workdir</tt>.<br /></td>
</tr>
</table>
</div>
<div class="section">
<h3><a name="Optional_Parameters"></a>Optional Parameters</h3>
<table class="bodyTable" border="0">
<tr class="a">
<th>Name</th>
<th>Type</th>
<th>Since</th>
<th>Description</th>
</tr>
<tr class="b">
<td><tt><a href="#action">&lt;action&gt;</a></tt></td>
<td><tt>String</tt></td>
<td><tt>1.0</tt></td>
<td>Argument to specify the action to take on each class. The available
actions are: buildSchema, validate<br /></td>
</tr>
<tr class="a">
<td><tt><a href="#connectionDriverName">&lt;connectionDriverName&gt;</a></tt></td>
<td><tt>String</tt></td>
<td><tt>1.0</tt></td>
<td>
<p>This setting can be used to override any
openjpa.ConnectionDriverName set in the persistence.xml. It can
also be used if the persistence.xml contains no connection
information at all.</p>
<p>Sample:</p>
<div>
<pre>
&lt;connectionDriverName&gt;com.mchange.v2.c3p0.ComboPooledDataSource&lt;/connectionDriverName&gt;
</pre></div>
This is most times used in conjunction with
<tt>connectionProperties</tt>.<br /></td>
</tr>
<tr class="b">
<td><tt><a href="#connectionProperties">&lt;connectionProperties&gt;</a></tt></td>
<td><tt>String</tt></td>
<td><tt>1.0</tt></td>
<td>
<p>Used to define the credentials or any other connection
properties.</p>
Sample:
<div>
<pre>
&lt;connectionProperties&gt;
driverClass=com.mysql.jdbc.Driver,
jdbcUrl=jdbc:mysql://localhost/mydatabase,
user=root,
password=,
minPoolSize=5,
acquireRetryAttempts=3,
maxPoolSize=20
&lt;/connectionProperties&gt;
</pre></div>
This is most times used in conjunction with
<tt>connectionDriverName</tt>.<br /></td>
</tr>
<tr class="a">
<td><tt><a href="#excludes">&lt;excludes&gt;</a></tt></td>
<td><tt>String</tt></td>
<td><tt>1.0</tt></td>
<td>Comma separated list of excludes to scan searchDir to pass to the
jobs. This option may be used to stop OpenJPA tasks from scanning
non-JPA classes (which usually leads to warnings such as &quot;Type xxx
has no metadata&quot;)<br /></td>
</tr>
<tr class="b">
<td><tt><a href="#includes">&lt;includes&gt;</a></tt></td>
<td><tt>String</tt></td>
<td><tt>1.0</tt></td>
<td>Comma separated list of includes to scan searchDir to pass to the
jobs. This may be used to restrict the OpenJPA tasks to e.g. a
single package which contains all the entities.<br /><b>Default value is</b>: <tt>**/*.class</tt>.<br /></td>
</tr>
<tr class="a">
<td><tt><a href="#modifyDatabase">&lt;modifyDatabase&gt;</a></tt></td>
<td><tt>boolean</tt></td>
<td><tt>1.0</tt></td>
<td>Use this option to write the planned schema modifications to the
database. If this is set, the sqlFile setting (if any) will be
ignored.<br /><b>Default value is</b>: <tt>false</tt>.<br /></td>
</tr>
<tr class="b">
<td><tt><a href="#persistenceUnitName">&lt;persistenceUnitName&gt;</a></tt></td>
<td><tt>String</tt></td>
<td><tt>1.0</tt></td>
<td>An optional PersistenceUnit name. If not specified then OpenJPA
will run against 'all anchors'. Means it will use all
persistenceunits of all persistence.xml files it finds.<br /><b>Default value is</b>: <tt>${openjpa.persistenceUnitName}</tt>.<br /></td>
</tr>
<tr class="a">
<td><tt><a href="#persistenceXmlFile">&lt;persistenceXmlFile&gt;</a></tt></td>
<td><tt>String</tt></td>
<td><tt>1.0</tt></td>
<td>Used if a non-default file location for the persistence.xml should
be used If not specified, the default one in
META-INF/persistence.xml will be used. Since openjpa-2.3.0 this can
also be a resource location. In prior releases it was only possible
to specify a file location.<br /></td>
</tr>
<tr class="b">
<td><tt><a href="#skip">&lt;skip&gt;</a></tt></td>
<td><tt>boolean</tt></td>
<td><tt>1.0</tt></td>
<td>When <tt>true</tt>, skip the execution.<br /><b>Default value is</b>: <tt>false</tt>.<br /></td>
</tr>
<tr class="a">
<td><tt><a href="#sqlAction">&lt;sqlAction&gt;</a></tt></td>
<td><tt>String</tt></td>
<td><tt>1.0</tt></td>
<td>The action to take for generating the SQL. Actions can be composed
in a comma-separated list of one of the following items:
<ul>
<li>add (see MappingTool#ACTION_ADD)</li>
<li>refresh (see MappingTool#ACTION_REFRESH)</li>
<li>drop (see MappingTool#ACTION_DROP)</li>
<li>dropSchema (see MappingTool#ACTION_DROP_SCHEMA)</li>
<li>buildSchema (see MappingTool#ACTION_BUILD_SCHEMA)</li>
<li>import (see MappingTool#ACTION_IMPORT)</li>
<li>export (see MappingTool#ACTION_EXPORT)</li>
<li>validate (see MappingTool#ACTION_VALIDATE)</li>
</ul>
Technically this is the same like the <tt>schemaAction</tt>,
but we have to split it for the plugin to allow different actions
for generating the mapping and generating the SQL files.<br /><b>Default value is</b>: <tt>build</tt>.<br /></td>
</tr>
<tr class="b">
<td><tt><a href="#sqlFile">&lt;sqlFile&gt;</a></tt></td>
<td><tt>File</tt></td>
<td><tt>1.0</tt></td>
<td>Use this option to write the planned schema modifications to a SQL
script. Combine this with a schemaAction of &quot;build&quot; to generate a
script that recreates the schema for the current mappings, even if
the schema already exists.<br /><b>Default value is</b>: <tt>${project.build.directory}/database.sql</tt>.<br /></td>
</tr>
<tr class="a">
<td><tt><a href="#toolProperties">&lt;toolProperties&gt;</a></tt></td>
<td><tt>Properties</tt></td>
<td><tt>1.0</tt></td>
<td>Additional properties passed to the OpenJPA tools.<br /></td>
</tr>
</table>
</div>
<div class="section">
<h3><a name="Parameter_Details"></a>Parameter Details</h3>
<div class="section">
<h4><a name="a.3Caction.3E"></a><b><a name="action">&lt;action&gt;</a></b></h4>
<div>Argument to specify the action to take on each class. The available
actions are: buildSchema, validate</div>
<ul>
<li><b>Type</b>: <tt>java.lang.String</tt></li>
<li><b>Since</b>: <tt>1.0</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
</ul><hr /></div>
<div class="section">
<h4><a name="a.3Cclasses.3E"></a><b><a name="classes">&lt;classes&gt;</a></b></h4>
<div>Location where <tt>persistence-enabled</tt> classes are
located.</div>
<ul>
<li><b>Type</b>: <tt>java.io.File</tt></li>
<li><b>Since</b>: <tt>1.0</tt></li>
<li><b>Required</b>: <tt>Yes</tt></li>
<li><b>User Property</b>: <tt>openjpa.classes</tt></li>
<li><b>Default</b>: <tt>${project.build.outputDirectory}</tt></li>
</ul><hr /></div>
<div class="section">
<h4><a name="a.3CconnectionDriverName.3E"></a><b><a name="connectionDriverName">&lt;connectionDriverName&gt;</a></b></h4>
<div>
<p>This setting can be used to override any
openjpa.ConnectionDriverName set in the persistence.xml. It can
also be used if the persistence.xml contains no connection
information at all.</p>
<p>Sample:</p>
<div>
<pre>
&lt;connectionDriverName&gt;com.mchange.v2.c3p0.ComboPooledDataSource&lt;/connectionDriverName&gt;
</pre></div>
This is most times used in conjunction with
<tt>connectionProperties</tt>.</div>
<ul>
<li><b>Type</b>: <tt>java.lang.String</tt></li>
<li><b>Since</b>: <tt>1.0</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
</ul><hr /></div>
<div class="section">
<h4><a name="a.3CconnectionProperties.3E"></a><b><a name="connectionProperties">&lt;connectionProperties&gt;</a></b></h4>
<div>
<p>Used to define the credentials or any other connection
properties.</p>
Sample:
<div>
<pre>
&lt;connectionProperties&gt;
driverClass=com.mysql.jdbc.Driver,
jdbcUrl=jdbc:mysql://localhost/mydatabase,
user=root,
password=,
minPoolSize=5,
acquireRetryAttempts=3,
maxPoolSize=20
&lt;/connectionProperties&gt;
</pre></div>
This is most times used in conjunction with
<tt>connectionDriverName</tt>.</div>
<ul>
<li><b>Type</b>: <tt>java.lang.String</tt></li>
<li><b>Since</b>: <tt>1.0</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
</ul><hr /></div>
<div class="section">
<h4><a name="a.3Cexcludes.3E"></a><b><a name="excludes">&lt;excludes&gt;</a></b></h4>
<div>Comma separated list of excludes to scan searchDir to pass to the
jobs. This option may be used to stop OpenJPA tasks from scanning
non-JPA classes (which usually leads to warnings such as &quot;Type xxx
has no metadata&quot;)</div>
<ul>
<li><b>Type</b>: <tt>java.lang.String</tt></li>
<li><b>Since</b>: <tt>1.0</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
</ul><hr /></div>
<div class="section">
<h4><a name="a.3CforceMojoExecution.3E"></a><b><a name="forceMojoExecution">&lt;forceMojoExecution&gt;</a></b></h4>
<div>Setting this parameter to <tt>true</tt> will force the
execution of this mojo, even if it would get skipped usually.</div>
<ul>
<li><b>Type</b>: <tt>boolean</tt></li>
<li><b>Since</b>: <tt>1.0</tt></li>
<li><b>Required</b>: <tt>Yes</tt></li>
<li><b>User Property</b>: <tt>forceOpenJpaExecution</tt></li>
<li><b>Default</b>: <tt>false</tt></li>
</ul><hr /></div>
<div class="section">
<h4><a name="a.3Cincludes.3E"></a><b><a name="includes">&lt;includes&gt;</a></b></h4>
<div>Comma separated list of includes to scan searchDir to pass to the
jobs. This may be used to restrict the OpenJPA tasks to e.g. a
single package which contains all the entities.</div>
<ul>
<li><b>Type</b>: <tt>java.lang.String</tt></li>
<li><b>Since</b>: <tt>1.0</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>Default</b>: <tt>**/*.class</tt></li>
</ul><hr /></div>
<div class="section">
<h4><a name="a.3CmodifyDatabase.3E"></a><b><a name="modifyDatabase">&lt;modifyDatabase&gt;</a></b></h4>
<div>Use this option to write the planned schema modifications to the
database. If this is set, the sqlFile setting (if any) will be
ignored.</div>
<ul>
<li><b>Type</b>: <tt>boolean</tt></li>
<li><b>Since</b>: <tt>1.0</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>Default</b>: <tt>false</tt></li>
</ul><hr /></div>
<div class="section">
<h4><a name="a.3CpersistenceUnitName.3E"></a><b><a name="persistenceUnitName">&lt;persistenceUnitName&gt;</a></b></h4>
<div>An optional PersistenceUnit name. If not specified then OpenJPA
will run against 'all anchors'. Means it will use all
persistenceunits of all persistence.xml files it finds.</div>
<ul>
<li><b>Type</b>: <tt>java.lang.String</tt></li>
<li><b>Since</b>: <tt>1.0</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>Default</b>: <tt>${openjpa.persistenceUnitName}</tt></li>
</ul><hr /></div>
<div class="section">
<h4><a name="a.3CpersistenceXmlFile.3E"></a><b><a name="persistenceXmlFile">&lt;persistenceXmlFile&gt;</a></b></h4>
<div>Used if a non-default file location for the persistence.xml should
be used If not specified, the default one in
META-INF/persistence.xml will be used. Since openjpa-2.3.0 this can
also be a resource location. In prior releases it was only possible
to specify a file location.</div>
<ul>
<li><b>Type</b>: <tt>java.lang.String</tt></li>
<li><b>Since</b>: <tt>1.0</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
</ul><hr /></div>
<div class="section">
<h4><a name="a.3Cskip.3E"></a><b><a name="skip">&lt;skip&gt;</a></b></h4>
<div>When <tt>true</tt>, skip the execution.</div>
<ul>
<li><b>Type</b>: <tt>boolean</tt></li>
<li><b>Since</b>: <tt>1.0</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>Default</b>: <tt>false</tt></li>
</ul><hr /></div>
<div class="section">
<h4><a name="a.3CsqlAction.3E"></a><b><a name="sqlAction">&lt;sqlAction&gt;</a></b></h4>
<div>The action to take for generating the SQL. Actions can be composed
in a comma-separated list of one of the following items:
<ul>
<li>add (see MappingTool#ACTION_ADD)</li>
<li>refresh (see MappingTool#ACTION_REFRESH)</li>
<li>drop (see MappingTool#ACTION_DROP)</li>
<li>dropSchema (see MappingTool#ACTION_DROP_SCHEMA)</li>
<li>buildSchema (see MappingTool#ACTION_BUILD_SCHEMA)</li>
<li>import (see MappingTool#ACTION_IMPORT)</li>
<li>export (see MappingTool#ACTION_EXPORT)</li>
<li>validate (see MappingTool#ACTION_VALIDATE)</li>
</ul>
Technically this is the same like the <tt>schemaAction</tt>,
but we have to split it for the plugin to allow different actions
for generating the mapping and generating the SQL files.</div>
<ul>
<li><b>Type</b>: <tt>java.lang.String</tt></li>
<li><b>Since</b>: <tt>1.0</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>Default</b>: <tt>build</tt></li>
</ul><hr /></div>
<div class="section">
<h4><a name="a.3CsqlFile.3E"></a><b><a name="sqlFile">&lt;sqlFile&gt;</a></b></h4>
<div>Use this option to write the planned schema modifications to a SQL
script. Combine this with a schemaAction of &quot;build&quot; to generate a
script that recreates the schema for the current mappings, even if
the schema already exists.</div>
<ul>
<li><b>Type</b>: <tt>java.io.File</tt></li>
<li><b>Since</b>: <tt>1.0</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
<li><b>Default</b>: <tt>${project.build.directory}/database.sql</tt></li>
</ul><hr /></div>
<div class="section">
<h4><a name="a.3CtoolProperties.3E"></a><b><a name="toolProperties">&lt;toolProperties&gt;</a></b></h4>
<div>Additional properties passed to the OpenJPA tools.</div>
<ul>
<li><b>Type</b>: <tt>java.util.Properties</tt></li>
<li><b>Since</b>: <tt>1.0</tt></li>
<li><b>Required</b>: <tt>No</tt></li>
</ul><hr /></div>
<div class="section">
<h4><a name="a.3CworkDir.3E"></a><b><a name="workDir">&lt;workDir&gt;</a></b></h4>
<div>The working directory for putting persistence.xml and other stuff
into if we need to.</div>
<ul>
<li><b>Type</b>: <tt>java.io.File</tt></li>
<li><b>Since</b>: <tt>1.0</tt></li>
<li><b>Required</b>: <tt>Yes</tt></li>
<li><b>User Property</b>: <tt>openjpa.workdir</tt></li>
<li><b>Default</b>: <tt>${project.build.directory}/openjpa-work</tt></li>
</ul>
</div></div>
</div>
</div>
</div>
<div class="clear">
<hr/>
</div>
<div id="footer">
<div class="xright">
Copyright &#169; 2011&#x2013;2020 <a href="http://www.apache.org">Apache Software Foundation</a>.
All rights reserved. </div>
<div class="clear">
<hr/>
</div>
</div>
</body>
</html>