Class StoredProcedureGenerator
java.lang.Object
org.eclipse.persistence.tools.schemaframework.StoredProcedureGenerator
Purpose: To generate StoredProcedures from EclipseLink Projects
Description: This Class was designed to read in a project and produce StoredProcedures. It then modifies the descriptors files of the project to use these StoredProcedures. NOTE: reads are not supported in Oracle.
Responsibilities:
- Author:
- Gordon Yorke
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
INTERNAL: Build all conversions based on JDBC return values.protected String
buildProcedureString
(SQLCall call) INTERNAL: Given a call, this method produces the stored procedure string based on the SQL string inside the call.void
generateAmendmentClass
(Writer outputWriter, String packageName, String className) PUBLIC: Generate an amendment class that will set up the descriptors to use these stored procedures.protected StoredProcedureDefinition
generateDeleteStoredProcedure
(ClassDescriptor descriptor) INTERNAL: Generates the delete stored procedure for this descriptorprotected StoredProcedureDefinition
generateInsertStoredProcedure
(ClassDescriptor descriptor) INTERNAL: Generates the insert stored procedure for this descriptorprotected Hashtable
generateMappingStoredProcedures
(ClassDescriptor descriptor) INTERNAL: Generates the mapping stored procedures for this descriptor.protected StoredProcedureDefinition
generateObjectStoredProcedure
(DatabaseQuery query, List fields, String namePrefix) INTERNAL: Generates the object level stored procedure based on the passed in queryprotected StoredProcedureDefinition
INTERNAL: Generates the delete all stored procedure for this mappingprotected StoredProcedureDefinition
generateOneToManyMappingProcedures
(OneToManyMapping mapping, DatabaseQuery query, Map<org.eclipse.persistence.internal.helper.DatabaseField, org.eclipse.persistence.internal.helper.DatabaseField> fields, String namePrefix) INTERNAL: Generates all the stored procedures for this mappingprotected StoredProcedureDefinition
INTERNAL: Generates the read all stored procedure for this mappingprotected StoredProcedureDefinition
generateReadAllStoredProcedure
(ClassDescriptor descriptor) INTERNAL: Generates the read all stored procedure for this descriptorprotected StoredProcedureDefinition
generateReadStoredProcedure
(ClassDescriptor descriptor) INTERNAL: Generates the read stored procedure for this descriptorprotected void
generateSequenceStoredProcedures
(Project project) INTERNAL: Generates the select and update stored procedures for this project.protected StoredProcedureDefinition
generateStoredProcedure
(DatabaseQuery query, List<org.eclipse.persistence.internal.helper.DatabaseField> fields, String name) INTERNAL: Generates the stored procedure for this query.protected StoredProcedureDefinition
generateStoredProcedure
(DatabaseQuery query, List<org.eclipse.persistence.internal.helper.DatabaseField> fields, org.eclipse.persistence.internal.sessions.AbstractRecord rowForPrepare, String name) INTERNAL: Generates the stored procedure for this query using the row passed in for the check prepare.void
PUBLIC: generates all the stored procedures using the schema manager.void
generateStoredProcedures
(Writer writerOrNull) PUBLIC: generates all the stored procedures to the writer using the schema manager outputDDLToWriter(Writer).protected StoredProcedureDefinition
generateUpdateStoredProcedure
(ClassDescriptor descriptor) INTERNAL: Generates the update stored procedure for this descriptorprotected String
getFieldName
(String argumentName) INTERNAL: return the original field name based on the argument name.protected Class
getFieldType
(Object jdbcDataType) INTERNAL: return the class corresponding to the passed in JDBC type.org.eclipse.persistence.internal.sessions.AbstractSession
void
protected void
verify()
INTERNAL: Verify that this project and descriptors do not have optimistic locking.void
writeDefinition
(StoredProcedureDefinition definition)
-
Field Details
-
schemaManager
-
-
Constructor Details
-
StoredProcedureGenerator
-
-
Method Details
-
buildIntToTypeConverterHash
protected void buildIntToTypeConverterHash()INTERNAL: Build all conversions based on JDBC return values. -
buildProcedureString
INTERNAL: Given a call, this method produces the stored procedure string based on the SQL string inside the call. -
generateAmendmentClass
public void generateAmendmentClass(Writer outputWriter, String packageName, String className) throws ValidationException PUBLIC: Generate an amendment class that will set up the descriptors to use these stored procedures.- Throws:
ValidationException
-
generateDeleteStoredProcedure
INTERNAL: Generates the delete stored procedure for this descriptor -
generateInsertStoredProcedure
INTERNAL: Generates the insert stored procedure for this descriptor -
generateMappingStoredProcedures
INTERNAL: Generates the mapping stored procedures for this descriptor. currently only 1:1 and 1:M are supported -
generateObjectStoredProcedure
protected StoredProcedureDefinition generateObjectStoredProcedure(DatabaseQuery query, List fields, String namePrefix) INTERNAL: Generates the object level stored procedure based on the passed in query -
generateOneToManyMappingDeleteAllProcedure
protected StoredProcedureDefinition generateOneToManyMappingDeleteAllProcedure(OneToManyMapping mapping) INTERNAL: Generates the delete all stored procedure for this mapping -
generateOneToManyMappingProcedures
protected StoredProcedureDefinition generateOneToManyMappingProcedures(OneToManyMapping mapping, DatabaseQuery query, Map<org.eclipse.persistence.internal.helper.DatabaseField, org.eclipse.persistence.internal.helper.DatabaseField> fields, String namePrefix) INTERNAL: Generates all the stored procedures for this mapping -
generateOneToManyMappingReadProcedure
INTERNAL: Generates the read all stored procedure for this mapping -
generateReadAllStoredProcedure
INTERNAL: Generates the read all stored procedure for this descriptor -
generateReadStoredProcedure
INTERNAL: Generates the read stored procedure for this descriptor -
generateSequenceStoredProcedures
INTERNAL: Generates the select and update stored procedures for this project. no procedures are generated for native sequencing. Note: reads are not supported in Oracle. -
generateStoredProcedure
protected StoredProcedureDefinition generateStoredProcedure(DatabaseQuery query, List<org.eclipse.persistence.internal.helper.DatabaseField> fields, String name) INTERNAL: Generates the stored procedure for this query. A new row will be used for the check prepare. -
generateStoredProcedure
protected StoredProcedureDefinition generateStoredProcedure(DatabaseQuery query, List<org.eclipse.persistence.internal.helper.DatabaseField> fields, org.eclipse.persistence.internal.sessions.AbstractRecord rowForPrepare, String name) INTERNAL: Generates the stored procedure for this query using the row passed in for the check prepare. -
generateStoredProcedures
public void generateStoredProcedures()PUBLIC: generates all the stored procedures using the schema manager. The schema manager may be set to write directly to the database on the a file. See outputDDLToWriter(Writer) and outputDDLToDatabase() on SchemaManager -
generateStoredProcedures
PUBLIC: generates all the stored procedures to the writer using the schema manager outputDDLToWriter(Writer). -
generateUpdateStoredProcedure
INTERNAL: Generates the update stored procedure for this descriptor -
getFieldName
INTERNAL: return the original field name based on the argument name. -
getFieldType
INTERNAL: return the class corresponding to the passed in JDBC type. -
getPrefix
-
getSession
public org.eclipse.persistence.internal.sessions.AbstractSession getSession() -
getWriter
-
setPrefix
-
verify
INTERNAL: Verify that this project and descriptors do not have optimistic locking.- Throws:
ValidationException
-
writeDefinition
-