Module eclipselink

Class StoredProcedureDefinition

java.lang.Object
org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition
org.eclipse.persistence.tools.schemaframework.StoredProcedureDefinition
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
StoredFunctionDefinition

public class StoredProcedureDefinition extends DatabaseObjectDefinition
Purpose: Allow a semi-generic way of creating stored procedures.
See Also:
  • Field Details

  • Constructor Details

    • StoredProcedureDefinition

      public StoredProcedureDefinition()
  • Method Details

    • addArgument

      public void addArgument(String argumentName, Class<?> type)
      The arguments are the names of the parameters to the procedure.
    • addArgument

      public void addArgument(String argumentName, Class<?> type, int size)
      The arguments are the names of the parameters to the procedure.
    • addArgument

      public void addArgument(String argumentName, String typeName)
      The arguments are the names of the parameters to the procedure.
    • addArgument

      public void addArgument(FieldDefinition argument)
      The arguments are the names of the parameters to the procedure.
    • addInOutputArgument

      public void addInOutputArgument(String argumentName, Class<?> type)
      The output arguments are used to get values back from the proc.
    • addInOutputArgument

      public void addInOutputArgument(FieldDefinition argument)
      The output arguments are used to get values back from the proc, such as cursors.
    • addOutputArgument

      public void addOutputArgument(String argumentName, Class<?> type)
      The output arguments are used to get values back from the proc.
    • addOutputArgument

      public void addOutputArgument(String argumentName, Class<?> type, int size)
      The output arguments are used to get values back from the proc.
    • addOutputArgument

      public void addOutputArgument(String argumentName, String typeName)
      The output arguments are used to get values back from the proc, such as cursors.
    • addOutputArgument

      public void addOutputArgument(FieldDefinition argument)
      The output arguments are used to get values back from the proc, such as cursors.
    • addStatement

      public void addStatement(String statement)
      The statements are the SQL lines of code in procedure.
    • addCharacteristic

      public void addCharacteristic(String characteristic)
      Add characteristic into the characteristics section of function/procedure.
      Parameters:
      characteristic - the function/procedure characteristic
    • addVariable

      public void addVariable(String variableName, String typeName)
      The variables are the names of the declared variables used in the procedure.
    • addVariable

      public void addVariable(FieldDefinition variable)
      The variables are the names of the declared variables used in the procedure.
    • buildCreationWriter

      public Writer buildCreationWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, Writer writer) throws ValidationException
      INTERNAL: Return the create table statement.
      Specified by:
      buildCreationWriter in class DatabaseObjectDefinition
      Throws:
      ValidationException
    • buildDeletionWriter

      public Writer buildDeletionWriter(org.eclipse.persistence.internal.sessions.AbstractSession session, Writer writer) throws ValidationException
      INTERNAL: Return the drop table statement.
      Specified by:
      buildDeletionWriter in class DatabaseObjectDefinition
      Throws:
      ValidationException
    • getArguments

      public List<FieldDefinition> getArguments()
      The arguments are the names of the parameters to the procedure.
    • getCreationHeader

      public String getCreationHeader()
    • getDeletionHeader

      public String getDeletionHeader()
    • getFirstArgumentIndex

      public int getFirstArgumentIndex()
    • getArgumentTypes

      public List<Integer> getArgumentTypes()
    • getStatements

      public List<String> getStatements()
      The statements are the SQL lines of code in procedure.
    • getCharacteristics

      public List<String> getCharacteristics()
      The characteristic section in procedure. E.g. COMMENT <string>, DETERMINISTIC, MODIFIES SQL DATA, NO SQL, ... .
    • getVariables

      public List<FieldDefinition> getVariables()
      The variables are the names of the declared variables used in the procedure.
    • printArgument

      protected void printArgument(FieldDefinition argument, Writer writer, org.eclipse.persistence.internal.sessions.AbstractSession session) throws IOException
      Print the argument and its type.
      Parameters:
      argument - Stored procedure argument.
      writer - Target writer where to write argument string.
      session - Current session context.
      Throws:
      IOException - When any IO problem occurs.
    • printInOutputArgument

      protected void printInOutputArgument(FieldDefinition argument, Writer writer, org.eclipse.persistence.internal.sessions.AbstractSession session) throws ValidationException
      Print the argument and its type.
      Parameters:
      argument - Stored procedure argument.
      writer - Target writer where to write argument string.
      session - Current session context.
      Throws:
      ValidationException - When invalid or inconsistent data were found.
    • printOutputArgument

      protected void printOutputArgument(FieldDefinition argument, Writer writer, org.eclipse.persistence.internal.sessions.AbstractSession session) throws ValidationException
      Print the argument and its type.
      Parameters:
      argument - Stored procedure argument.
      writer - Target writer where to write argument string.
      session - Current session context.
      Throws:
      ValidationException - When invalid or inconsistent data were found.
    • printReturn

      protected void printReturn(Writer writer, org.eclipse.persistence.internal.sessions.AbstractSession session) throws ValidationException
      Prints return for stored function, nothing to do for stored procedure
      Throws:
      ValidationException
    • setArguments

      public void setArguments(List<FieldDefinition> arguments)
      The arguments are the field defs of the parameters names and types to the procedure.
    • setStatements

      public void setStatements(List<String> statements)
      The statements are the SQL lines of code in procedure.
    • setVariables

      public void setVariables(List<FieldDefinition> variables)
      The variables are the field defs of the declared variables used in the procedure.