blob: b7101e49b2827758de5c7f88713fd23b90bab758 [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 src/site/apt/examples/credentials.apt at 06 Sep 2020 22:01 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; Enhance</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 name="author" content="Mark Struberg
struberg@yahoo.de" />
<meta name="date" content="March 19, 2010" />
<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:01 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="Specifying_connection_settings_in_the_plugin_section"></a>Specifying connection settings in the plugin section</h2>
<p>Sometimes it's necessary to set (or override) the connection settings which are needed at build time in the plugin section because the persistence.xml doesn't contain the correct information.</p>
<p>This can be performed with the 2 optional parameters</p>
<ul>
<li><tt>connectionDriverName</tt> which defines the driver class</li>
<li><tt>connectionProperties</tt> which defines further properties
<div>
<pre>&lt;project&gt;
[...]
&lt;build&gt;
[...]
&lt;plugins&gt;
&lt;plugin&gt;
&lt;groupId&gt;org.apache.openjpa&lt;/groupId&gt;
&lt;artifactId&gt;openjpa-maven-plugin&lt;/artifactId&gt;
&lt;version&gt;1.2&lt;/version&gt;
&lt;configuration&gt;
&lt;includes&gt;
com/mycompany/myproject/myentities/*.class
&lt;/includes&gt;
&lt;addDefaultConstructor&gt;true&lt;/addDefaultConstructor&gt;
&lt;enforcePropertyRestrictions&gt;true&lt;/enforcePropertyRestrictions&gt;
&lt;sqlAction&gt;refresh&lt;/sqlAction&gt;
&lt;sqlFile&gt;${project.build.directory}/database.sql&lt;/sqlFile&gt;
&lt;connectionDriverName&gt;com.mchange.v2.c3p0.ComboPooledDataSource&lt;/connectionDriverName&gt;
&lt;connectionProperties&gt;
driverClass=com.mysql.jdbc.Driver,
jdbcUrl=jdbc:mysql://localhost/TissExamples,
user=root,
password=,
minPoolSize=5,
acquireRetryAttempts=3,
maxPoolSize=20
&lt;/connectionProperties&gt;
&lt;/configuration&gt;
&lt;executions&gt;
&lt;execution&gt;
&lt;id&gt;mappingtool&lt;/id&gt;
&lt;phase&gt;process-classes&lt;/phase&gt;
&lt;goals&gt;
&lt;goal&gt;enhance&lt;/goal&gt;
&lt;/goals&gt;
&lt;/execution&gt;
&lt;/executions&gt;
&lt;dependencies&gt;
&lt;dependency&gt;
&lt;groupId&gt;log4j&lt;/groupId&gt;
&lt;artifactId&gt;log4j&lt;/artifactId&gt;
&lt;version&gt;1.2.12&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;org.apache.openjpa&lt;/groupId&gt;
&lt;artifactId&gt;openjpa-all&lt;/artifactId&gt;
&lt;version&gt;2.0.1&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;net.sourceforge.cobertura&lt;/groupId&gt;
&lt;artifactId&gt;cobertura&lt;/artifactId&gt;
&lt;version&gt;1.9.2&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;c3p0&lt;/groupId&gt;
&lt;artifactId&gt;c3p0&lt;/artifactId&gt;
&lt;version&gt;0.9.1&lt;/version&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
&lt;groupId&gt;mysql&lt;/groupId&gt;
&lt;artifactId&gt;mysql-connector-java&lt;/artifactId&gt;
&lt;version&gt;5.1.11&lt;/version&gt;
&lt;/dependency&gt;
&lt;/dependencies&gt;
&lt;/plugin&gt;
[...]
&lt;/plugins&gt;
[...]
&lt;/build&gt;
[...]
&lt;/project&gt;</pre></div></li></ul></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>