Class OraclePlatform

    • Field Detail

      • vpdSetIdentifierQuery

        protected static DataModifyQuery vpdSetIdentifierQuery
      • vpdClearIdentifierQuery

        protected static DataModifyQuery vpdClearIdentifierQuery
      • shouldPrintForUpdateClause

        protected boolean shouldPrintForUpdateClause
        Whether a FOR UPDATE clause should be printed at the end of the query
      • supportsIdentity

        protected boolean supportsIdentity
        Advanced attribute indicating whether identity is supported, see comment to setSupportsIdentity method.
      • SELECT

        protected String SELECT
      • HINT_START

        protected String HINT_START
      • HINT_END

        protected String HINT_END
      • END_FROM

        protected String END_FROM
      • MAX_ROW

        protected String MAX_ROW
      • MIN_ROW

        protected String MIN_ROW
      • LOCK_START_PREFIX

        protected String LOCK_START_PREFIX
      • LOCK_START_PREFIX_WHERE

        protected String LOCK_START_PREFIX_WHERE
      • LOCK_START_SUFFIX

        protected String LOCK_START_SUFFIX
      • LOCK_END

        protected String LOCK_END
      • SELECT_ID_PREFIX

        protected String SELECT_ID_PREFIX
      • SELECT_ID_SUFFIX

        protected String SELECT_ID_SUFFIX
      • FROM_ID

        protected String FROM_ID
      • END_FROM_ID

        protected String END_FROM_ID
      • ORDER_BY_ID

        protected String ORDER_BY_ID
      • BRACKET_END

        protected String BRACKET_END
    • Constructor Detail

      • OraclePlatform

        public OraclePlatform()
    • Method Detail

      • appendByteArray

        protected void appendByteArray​(byte[] bytes,
                                       Writer writer)
                                throws IOException
        INTERNAL: If using native SQL then print a byte[] literally as a hex string otherwise use ODBC format as provided in DatabasePlatform.
        Overrides:
        appendByteArray in class DatabasePlatform
        Throws:
        IOException
      • appendDate

        protected void appendDate​(Date date,
                                  Writer writer)
                           throws IOException
        INTERNAL: Appends an Oracle specific date if usesNativeSQL is true otherwise use the ODBC format. Native FORMAT: to_date('1997-11-06','yyyy-mm-dd')
        Overrides:
        appendDate in class DatabasePlatform
        Throws:
        IOException
      • appendTime

        protected void appendTime​(Time time,
                                  Writer writer)
                           throws IOException
        INTERNAL: Appends an Oracle specific time if usesNativeSQL is true otherwise use the ODBC format. Native FORMAT: to_date(#####, 'sssss').
        Overrides:
        appendTime in class DatabasePlatform
        Throws:
        IOException
      • appendTimestamp

        protected void appendTimestamp​(Timestamp timestamp,
                                       Writer writer)
                                throws IOException
        INTERNAL: Appends an Oracle specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format. Native Format: to_date ('1997-11-06 10:35:45.0' , 'yyyy-mm-dd hh:mm:ss.n')
        Overrides:
        appendTimestamp in class DatabasePlatform
        Throws:
        IOException
      • appendCalendar

        protected void appendCalendar​(Calendar calendar,
                                      Writer writer)
                               throws IOException
        INTERNAL: Appends an Oracle specific Timestamp, if usesNativeSQL is true otherwise use the ODBC format. Native Format: to_date ('1997-11-06 10:35:45.0' , 'yyyy-mm-dd hh:mm:ss.n')
        Overrides:
        appendCalendar in class DatabasePlatform
        Throws:
        IOException
      • buildFirstRowsHint

        protected String buildFirstRowsHint​(int max)
        Build the hint string used for first rows. Allows it to be overridden
        Parameters:
        max -
        Returns:
      • canBuildCallWithReturning

        public boolean canBuildCallWithReturning()
        INTERNAL: Indicates whether the platform can build call with returning. In case this method returns true, buildCallWithReturning method may be called.
        Overrides:
        canBuildCallWithReturning in class DatabasePlatform
      • clearOracleConnectionCache

        public void clearOracleConnectionCache​(Connection conn)
        INTERNAL: Clears both implicit and explicit caches of OracleConnection on Oracle9Platform, noop here.
      • getDeclareBeginString

        public String getDeclareBeginString()
        INTERNAL: DECLARE stanza header for Anonymous PL/SQL block
      • isRowCountOutputParameterRequired

        public boolean isRowCountOutputParameterRequired()
        Oracle does not return the row count from PLSQL anon blocks, so an output parameter is required for this.
        Overrides:
        isRowCountOutputParameterRequired in class DatabasePlatform
      • getMaxFieldNameSize

        public int getMaxFieldNameSize()
        INTERNAL: returns the maximum number of characters that can be used in a field name on this platform.
        Overrides:
        getMaxFieldNameSize in class DatabasePlatform
      • getNativeTableInfo

        public Vector getNativeTableInfo​(String table,
                                         String creator,
                                         AbstractSession session)
        Return the catalog information through using the native SQL catalog selects. This is required because many JDBC driver do not support meta-data. Willcards can be passed as arguments.
      • getDropCascadeString

        public String getDropCascadeString()
        Allows DROP TABLE to cascade dropping of any dependent constraints if the database supports this option.
        Overrides:
        getDropCascadeString in class DatabasePlatform
      • getSystemChangeNumberQuery

        public ValueReadQuery getSystemChangeNumberQuery()
        PUBLIC: The query to select the current system change number from Oracle. In order to execute this query a database administrator may need to grant execute permission on pl/sql package DBMS_FLASHBACK.
      • getObjectFromResultSet

        public Object getObjectFromResultSet​(ResultSet resultSet,
                                             int columnNumber,
                                             int type,
                                             AbstractSession session)
                                      throws SQLException
        INTERNAL: Get a timestamp value from a result set. Overrides the default behavior to specifically return a timestamp. Added to overcome an issue with the oracle 9.0.1.4 JDBC driver.
        Overrides:
        getObjectFromResultSet in class DatabasePlatform
        Throws:
        SQLException
        See Also:
        "org.eclipse.persistence.platform.database.oracle.Oracle9Plaform"
      • exceptOperator

        public static ExpressionOperator exceptOperator()
        INTERNAL: Create the EXCEPT operator, MINUS in Oracle.
      • regexpOperator

        public static ExpressionOperator regexpOperator()
        INTERNAL: Create the REGEXP_LIKE operator.
      • isNativeConnectionRequiredForLobLocator

        public boolean isNativeConnectionRequiredForLobLocator()
        INTERNAL: Used by derived platforms (Oracle8Platform and higher) to indicate whether app. server should unwrap connection to use lob locator.
      • logOperator

        protected ExpressionOperator logOperator()
        Create the log operator for this platform
      • maximumNumericValues

        public Hashtable maximumNumericValues()
        Builds a table of maximum numeric values keyed on java class. This is used for type testing but might also be useful to end users attempting to sanitize values.

        NOTE: BigInteger & BigDecimal maximums are dependent upon their precision & Scale

        Overrides:
        maximumNumericValues in class DatabasePlatform
      • minimumNumericValues

        public Hashtable minimumNumericValues()
        Builds a table of minimum numeric values keyed on java class. This is used for type testing but might also be useful to end users attempting to sanitize values.

        NOTE: BigInteger & BigDecimal minimums are dependent upon their precision & Scale

        Overrides:
        minimumNumericValues in class DatabasePlatform
      • buildSelectQueryForSequenceObject

        public ValueReadQuery buildSelectQueryForSequenceObject​(String qualifiedSeqName,
                                                                Integer size)
        INTERNAL: Produce a DataReadQuery which updates(!) the sequence number in the db and returns it. Currently implemented on Oracle only.
        Overrides:
        buildSelectQueryForSequenceObject in class DatasourcePlatform
        Parameters:
        qualifiedSeqName - known by Oracle to be a defined sequence
      • buildSelectQueryForIdentity

        public ValueReadQuery buildSelectQueryForIdentity​(String qualifiedSeqName,
                                                          Integer size)
        INTERNAL: Though Oracle doesn't support identity it could be imitated, see comment to setSupportsIdentity method.
        Overrides:
        buildSelectQueryForIdentity in class DatasourcePlatform
        Parameters:
        qualifiedSeqName - known by Oracle to be a defined sequence
      • operatorOuterJoin

        protected ExpressionOperator operatorOuterJoin()
        Create the outer join operator for this platform
      • operatorLocate

        protected ExpressionOperator operatorLocate()
        INTERNAL: Override the default locate operator
      • operatorLocate2

        protected ExpressionOperator operatorLocate2()
        INTERNAL: Override the default locate operator
      • serverTimestampString

        public String serverTimestampString()
        Return the current date and time from the server.
      • shouldPrintStoredProcedureArgumentNameInCall

        public boolean shouldPrintStoredProcedureArgumentNameInCall()
        INTERNAL: Should the variable name of a stored procedure call be printed as part of the procedure call e.g. EXECUTE PROCEDURE MyStoredProc(myvariable = ?)
        Overrides:
        shouldPrintStoredProcedureArgumentNameInCall in class DatabasePlatform
      • shouldUseJDBCOuterJoinSyntax

        public boolean shouldUseJDBCOuterJoinSyntax()
        JDBC defines and outer join syntax, many drivers do not support this. So we normally avoid it.
        Overrides:
        shouldUseJDBCOuterJoinSyntax in class DatabasePlatform
      • supportsAutoConversionToNumericForArithmeticOperations

        public boolean supportsAutoConversionToNumericForArithmeticOperations()
        Some db allow VARCHAR db field to be used in arithmetic operations automatically converting them to numeric: UPDATE OL_PHONE SET PHONE_ORDER_VARCHAR = (PHONE_ORDER_VARCHAR + 1) WHERE ... SELECT ... WHERE ... t0.MANAGED_ORDER_VARCHAR BETWEEN 1 AND 4 ...
        Overrides:
        supportsAutoConversionToNumericForArithmeticOperations in class DatabasePlatform
      • supportsSequenceObjects

        public boolean supportsSequenceObjects()
        INTERNAL: Indicates whether the platform supports sequence objects. This method is to be used *ONLY* by sequencing classes
        Overrides:
        supportsSequenceObjects in class DatasourcePlatform
      • supportsIdentity

        public boolean supportsIdentity()
        INTERNAL: Indicates whether the platform supports identity. This method is to be used *ONLY* by sequencing classes
        Overrides:
        supportsIdentity in class DatasourcePlatform
      • setSupportsIdentity

        public void setSupportsIdentity​(boolean supportsIdentity)
        ADVANCED: Oracle db doesn't support identity. However it's possible to get identity-like behavior using sequence in an insert trigger - that's the only case when supportsIdentity should be set to true: in this case all the sequences that have shouldAcquireValueAfterInsert set to true will keep this setting (it would've been reversed in case identity is not supported). Note that with supportsIdentity==true attempt to create tables that have identity fields will fail - Oracle doesn't support identity. Therefore if there's table creation reqiured it should be done with supportsIdentity==false, then set the flag to true and reset sequencing (or logout and login the session).
      • supportsSelectForUpdateNoWait

        public boolean supportsSelectForUpdateNoWait()
        Returns true if the database supports SQL syntax not to wait on a SELECT..FOR UPADTE (i.e. In Oracle adding NOWAIT to the end will accomplish this)
      • todayOperator

        protected ExpressionOperator todayOperator()
        Create the sysdate operator for this platform
      • canUnwrapOracleConnection

        public boolean canUnwrapOracleConnection()
        INTERNAL: Indicates whether this Oracle platform can unwrap Oracle connection.
      • unwrapOracleConnection

        public Connection unwrapOracleConnection​(Connection connection)
        INTERNAL: If can unwrap returns unwrapped Oracle connection, otherwise original connection.
      • useJDBCStoredProcedureSyntax

        public boolean useJDBCStoredProcedureSyntax()
        Return true if JDBC syntax should be used for stored procedure calls.
      • printSQLSelectStatement

        public void printSQLSelectStatement​(DatabaseCall call,
                                            ExpressionSQLPrinter printer,
                                            SQLSelectStatement statement)
        INTERNAL: Print the SQL representation of the statement on a stream, storing the fields in the DatabaseCall. This implementation works MaxRows and FirstResult into the SQL using Oracle's ROWNUM to filter values if shouldUseRownumFiltering is true.
        Overrides:
        printSQLSelectStatement in class DatabasePlatform
      • isAlterSequenceObjectSupported

        public boolean isAlterSequenceObjectSupported()
        INTERNAL: Override this method if the platform supports sequence objects and it's possible to alter sequence object's increment in the database.
        Overrides:
        isAlterSequenceObjectSupported in class DatabasePlatform
      • isForUpdateCompatibleWithDistinct

        public boolean isForUpdateCompatibleWithDistinct()
        INTERNAL: Indicates whether SELECT DISTINCT ... FOR UPDATE is allowed by the platform (Oracle doesn't allow this).
        Overrides:
        isForUpdateCompatibleWithDistinct in class DatabasePlatform
      • isLobCompatibleWithDistinct

        public boolean isLobCompatibleWithDistinct()
        INTERNAL: Indicates whether SELECT DISTINCT lob FROM ... (where lob is BLOB or CLOB) is allowed by the platform (Oracle doesn't allow this).
        Overrides:
        isLobCompatibleWithDistinct in class DatabasePlatform
      • wasFailureCommunicationBased

        public boolean wasFailureCommunicationBased​(SQLException exception,
                                                    Connection connection,
                                                    AbstractSession sessionForProfile)
        INTERNAL: A call to this method will perform a platform based check on the connection and exception error code to determine if the connection is still valid or if a communication error has occurred. If a communication error has occurred then the query may be retried. If this platform is unable to determine if the error was communication based it will return false forcing the error to be thrown to the user.
        Overrides:
        wasFailureCommunicationBased in class DatabasePlatform
      • getTableExistsQuery

        protected DataReadQuery getTableExistsQuery​(TableDefinition table)
        INTERNAL: Returns query to check whether given table exists. Query execution returns a row when table exists or empty result otherwise.
        Overrides:
        getTableExistsQuery in class DatabasePlatform
        Parameters:
        table - database table meta-data
        Returns:
        query to check whether given table exists
      • checkTableExists

        public boolean checkTableExists​(DatabaseSessionImpl session,
                                        TableDefinition table,
                                        boolean suppressLogging)
        INTERNAL: Executes and evaluates query to check whether given table exists. Returned value depends on returned result set being empty or not.
        Overrides:
        checkTableExists in class DatabasePlatform
        Parameters:
        session - current database session
        table - database table meta-data
        suppressLogging - whether to suppress logging during query execution
        Returns:
        value of true if given table exists or false otherwise