| ------ |
| Enhance |
| ------ |
| Mark Struberg |
| <struberg@yahoo.de> |
| ------ |
| March 19, 2010 |
| ------ |
| |
| Specifying connection settings in the plugin section |
| |
| 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. |
| |
| This can be performed with the 2 optional parameters |
| |
| * <<<connectionDriverName>>> which defines the driver class |
| |
| * <<<connectionProperties>>> which defines further properties |
| |
| ------------------- |
| <project> |
| [...] |
| <build> |
| [...] |
| <plugins> |
| <plugin> |
| <groupId>org.apache.openjpa</groupId> |
| <artifactId>openjpa-maven-plugin</artifactId> |
| <version>1.2</version> |
| <configuration> |
| <includes> |
| com/mycompany/myproject/myentities/*.class |
| </includes> |
| <addDefaultConstructor>true</addDefaultConstructor> |
| <enforcePropertyRestrictions>true</enforcePropertyRestrictions> |
| <sqlAction>refresh</sqlAction> |
| <sqlFile>${project.build.directory}/database.sql</sqlFile> |
| <connectionDriverName>com.mchange.v2.c3p0.ComboPooledDataSource</connectionDriverName> |
| <connectionProperties> |
| driverClass=com.mysql.cj.jdbc.Driver, |
| jdbcUrl=jdbc:mysql://localhost/TissExamples, |
| user=root, |
| password=, |
| minPoolSize=5, |
| acquireRetryAttempts=3, |
| maxPoolSize=20 |
| </connectionProperties> |
| </configuration> |
| <executions> |
| <execution> |
| <id>mappingtool</id> |
| <phase>process-classes</phase> |
| <goals> |
| <goal>enhance</goal> |
| </goals> |
| </execution> |
| </executions> |
| <dependencies> |
| <dependency> |
| <groupId>log4j</groupId> |
| <artifactId>log4j</artifactId> |
| <version>1.2.12</version> |
| </dependency> |
| <dependency> |
| <groupId>org.apache.openjpa</groupId> |
| <artifactId>openjpa-all</artifactId> |
| <version>2.0.1</version> |
| </dependency> |
| <dependency> |
| <groupId>net.sourceforge.cobertura</groupId> |
| <artifactId>cobertura</artifactId> |
| <version>1.9.2</version> |
| </dependency> |
| <dependency> |
| <groupId>c3p0</groupId> |
| <artifactId>c3p0</artifactId> |
| <version>0.9.1</version> |
| </dependency> |
| <dependency> |
| <groupId>com.mysql</groupId> |
| <artifactId>mysql-connector-j</artifactId> |
| <version>8.0.31</version> |
| </dependency> |
| </dependencies> |
| </plugin> |
| [...] |
| </plugins> |
| [...] |
| </build> |
| [...] |
| </project> |
| ------------------- |