Package org.apache.openjpa.tools.maven
Class OpenJpaSqlMojo
java.lang.Object
org.apache.maven.plugin.AbstractMojo
org.apache.openjpa.tools.maven.AbstractOpenJpaMojo
org.apache.openjpa.tools.maven.AbstractOpenJpaMappingToolMojo
org.apache.openjpa.tools.maven.OpenJpaSqlMojo
- All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled,org.apache.maven.plugin.Mojo
@Mojo(name="sql",
defaultPhase=PROCESS_CLASSES,
requiresDependencyResolution=COMPILE,
threadSafe=true)
public class OpenJpaSqlMojo
extends AbstractOpenJpaMappingToolMojo
Executes the SQL generation via the OpenJPA MappingTool.
- Since:
- 1.0
- Version:
- $Id$
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanUse this option to write the planned schema modifications to the database.protected static final Stringinternally the options is named 'schemaAction'!protected static final Stringused for passing the sqlFile parameter to the mapping toolprotected StringThe action to take for generating the SQL.protected FileUse this option to write the planned schema modifications to a SQL script.Fields inherited from class org.apache.openjpa.tools.maven.AbstractOpenJpaMappingToolMojo
action, OPTION_ACTIONFields inherited from class org.apache.openjpa.tools.maven.AbstractOpenJpaMojo
classes, compileClasspathElements, OPTION_CONNECTION_DRIVER_NAME, OPTION_CONNECTION_PROPERTIES, OPTION_PROPERTIES, OPTION_PROPERTIES_FILE, project, workDirFields inherited from interface org.apache.maven.plugin.Mojo
ROLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.openjpa.lib.util.OptionsGet the options for the various OpenJPA tools.Methods inherited from class org.apache.openjpa.tools.maven.AbstractOpenJpaMappingToolMojo
executeMethods inherited from class org.apache.openjpa.tools.maven.AbstractOpenJpaMojo
createOptions, extendRealmClasspath, findEntityClassFiles, getClasspathElements, getEntityClasses, getFilePaths, skipMojoMethods inherited from class org.apache.maven.plugin.AbstractMojo
getLog, getPluginContext, setLog, setPluginContext
-
Field Details
-
sqlAction
The action to take for generating the SQL. Actions can be composed in a comma-separated list of one of the following items:- add (see MappingTool#ACTION_ADD)
- refresh (see MappingTool#ACTION_REFRESH)
- drop (see MappingTool#ACTION_DROP)
- dropSchema (see MappingTool#ACTION_DROP_SCHEMA)
- buildSchema (see MappingTool#ACTION_BUILD_SCHEMA)
- import (see MappingTool#ACTION_IMPORT)
- export (see MappingTool#ACTION_EXPORT)
- validate (see MappingTool#ACTION_VALIDATE)
schemaAction, but we have to split it for the plugin to allow different actions for generating the mapping and generating the SQL files. -
OPTION_SQL_ACTION
internally the options is named 'schemaAction'!- See Also:
-
sqlFile
Use this option to write the planned schema modifications to a SQL script. Combine this with a schemaAction of "build" to generate a script that recreates the schema for the current mappings, even if the schema already exists. -
OPTION_SQL_FILE
used for passing the sqlFile parameter to the mapping tool- See Also:
-
modifyDatabase
@Parameter(defaultValue="false") protected boolean modifyDatabaseUse this option to write the planned schema modifications to the database. If this is set, the sqlFile setting (if any) will be ignored.
-
-
Constructor Details
-
OpenJpaSqlMojo
public OpenJpaSqlMojo()
-
-
Method Details
-
getOptions
protected org.apache.openjpa.lib.util.Options getOptions() throws org.apache.maven.plugin.MojoExecutionExceptionDescription copied from class:AbstractOpenJpaMojoGet the options for the various OpenJPA tools.- Specified by:
getOptionsin classAbstractOpenJpaMojo- Returns:
- Options filled with all necessary plugin parameters
- Throws:
org.apache.maven.plugin.MojoExecutionException
-