Package org.apache.openjpa.jdbc.schema
Class TableSchemaFactory
java.lang.Object
org.apache.openjpa.jdbc.schema.TableSchemaFactory
- All Implemented Interfaces:
SchemaFactory
,Configurable
Factory that uses an XML schema definition stored in a database table
to record the system schema.
- Author:
- Abe White
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Drops the sequence table in the DB.void
Invoked upon completion of bean property configuration for this object.The name of the primary key column on the schema definition table.The name of the schema column on the schema definition table.getTable()
The name of the schema definition table.static void
Usage: java org.apache.openjpa.jdbc.schema.TableSchemaFactory [option]* -action/-a <add | drop> Where the following options are recognized.Return the schema group for the current object model and database.Returns the schema as an XML string.void
Creates the schema table in the DB.static boolean
run
(JDBCConfiguration conf, String action) Run the tool.static boolean
run
(JDBCConfiguration conf, String[] args, Options opts) Run the tool.void
Invoked prior to setting bean properties.void
setPrimaryKeyColumn
(String name) The name of the primary key column on the schema definition table.void
setSchemaColumn
(String name) The name of the schema column on the schema definition table.void
The name of the schema definition table.void
setTableName
(String name) Deprecated.void
Invoked before bean property configuration is begun on this object.void
storeSchema
(SchemaGroup schema) Record the schema group after changes may have been made.void
writeSchemaColumn
(String schema) Writes the schema as a string to the database.
-
Field Details
-
ACTION_ADD
- See Also:
-
ACTION_DROP
- See Also:
-
-
Constructor Details
-
TableSchemaFactory
public TableSchemaFactory()
-
-
Method Details
-
getTable
The name of the schema definition table. Defaults toOPENJPA_SCHEMA
. -
setTable
The name of the schema definition table. Defaults toOPENJPA_SCHEMA
. -
setTableName
Deprecated.UsesetTable(java.lang.String)
. Retained for backwards-compatible auto-configuration. -
setPrimaryKeyColumn
The name of the primary key column on the schema definition table. Defaults toID
. -
getPrimaryKeyColumn
The name of the primary key column on the schema definition table. Defaults toID
. -
setSchemaColumn
The name of the schema column on the schema definition table. Defaults toSCHEMA_DEF
. -
getSchemaColumn
The name of the schema column on the schema definition table. Defaults toSCHEMA_DEF
. -
getConfiguration
-
setConfiguration
Description copied from interface:Configurable
Invoked prior to setting bean properties.- Specified by:
setConfiguration
in interfaceConfigurable
-
startConfiguration
public void startConfiguration()Description copied from interface:Configurable
Invoked before bean property configuration is begun on this object.- Specified by:
startConfiguration
in interfaceConfigurable
-
endConfiguration
public void endConfiguration()Description copied from interface:Configurable
Invoked upon completion of bean property configuration for this object.- Specified by:
endConfiguration
in interfaceConfigurable
-
readSchema
Description copied from interface:SchemaFactory
Return the schema group for the current object model and database.- Specified by:
readSchema
in interfaceSchemaFactory
-
storeSchema
Description copied from interface:SchemaFactory
Record the schema group after changes may have been made.- Specified by:
storeSchema
in interfaceSchemaFactory
- Parameters:
schema
- the schema definition for the entire system
-
refreshTable
Creates the schema table in the DB.- Throws:
SQLException
-
dropTable
Drops the sequence table in the DB.- Throws:
SQLException
-
readSchemaColumn
Returns the schema as an XML string.- Throws:
SQLException
-
writeSchemaColumn
Writes the schema as a string to the database.- Throws:
SQLException
-
main
Usage: java org.apache.openjpa.jdbc.schema.TableSchemaFactory [option]* -action/-a <add | drop> Where the following options are recognized.- -properties/-p <properties file or resource>: The
path or resource name of a OpenJPA properties file containing
information such as the license key and connection data as
outlined in
JDBCConfiguration
. Optional. - -<property name> <property value>: All bean
properties of the OpenJPA
JDBCConfiguration
can be set by using their names and supplying a value. For example:-licenseKey adslfja83r3lkadf
- add: Create the schema table.
- drop: Drop the schema table.
- Throws:
IOException
SQLException
- -properties/-p <properties file or resource>: The
path or resource name of a OpenJPA properties file containing
information such as the license key and connection data as
outlined in
-
run
public static boolean run(JDBCConfiguration conf, String[] args, Options opts) throws IOException, SQLException Run the tool. Returns false if invalid options were given.- Throws:
IOException
SQLException
- See Also:
-
run
Run the tool.- Throws:
IOException
SQLException
-
setTable(java.lang.String)
.