Class HANAPlatform

  • All Implemented Interfaces:
    Serializable, Cloneable, CorePlatform<ConversionManager>, Platform

    public final class HANAPlatform
    extends DatabasePlatform
    Database Platform for SAP HANA

    Feature Testing
    ----------------------

    • DDL Generation - Succeeds
    • Outer Join - Succeeds
    • Subquery - Succeeds
    • Stored Procedure Calls - Not supported
    • Stored Procedure Generation - Not supported
    • Native Sequences/Identifier fields - Succeeds
    • JPA Bulk Update/Delete - Succeeds with Limitations
    • Batch Reading - Succeeds
    • Batch Writing - Succeeds
    • Pessimistic Locking - Succeeds with Limitations
    • First Result/Limit - Succeeds with Limitations
    • Expression Framework - Succeeds with Limitations
    • Delimiters - Succeeds
    • Auto Detection - Succeeds

    Limitations
    ----------------

    • Reserved SQL keywords cannot be used as table, column or sequence names. Use a different name, or enclose the name in double quotes. For example: @Column(name="\"LANGUAGE\"")
    • Pessimistic locking adds 'FOR UPDATE' to the SELECT statement, and cannot be used with queries that use DISTINCT.
    • Pessimistic locking cannot be used with queries that select from multiple tables.
    • The LockNoWait option of Pessimistic Locking cannot be used; it is ignored when specified (i.e. only 'FOR UPDATE' is added to the SELECT statement).
    • Bulk update and delete operations that require multiple tables to be accessed cannot be used (e.g. bulk operation on an entity that is part of an inheritance hierarchy, UpdateAll and DeleteAll queries). <li>'= NULL' and '<> NULL' cannot be used for null comparisons in the WHERE clause. Use 'IS (NOT) NULL' instead.
    • Scrollable cursors are not supported.
    • Query timeouts are not supported.
    Author:
    Reiner Singer (SAP AG), Sabine Heider (SAP AG)
    See Also:
    Serialized Form
    • Constructor Detail

      • HANAPlatform

        public HANAPlatform()
    • Method Detail

      • requiresUniqueConstraintCreationOnTableCreate

        public boolean requiresUniqueConstraintCreationOnTableCreate()
        Description copied from class: DatabasePlatform
        Used for table creation. If a database platform does not support ALTER TABLE syntax to add/drop unique constraints (like Symfoware), overriding this method will allow the constraint to be specified in the CREATE TABLE statement.

        This only affects unique constraints specified using the UniqueConstraint annotation or equivalent method. Columns for which the 'unique' attribute is set to true will be declared 'UNIQUE' in the CREATE TABLE statement regardless of the return value of this method.

        Overrides:
        requiresUniqueConstraintCreationOnTableCreate in class DatabasePlatform
        Returns:
        whether unique constraints should be declared as part of the CREATE TABLE statement instead of in separate ALTER TABLE ADD/DROP statements.
      • isForUpdateCompatibleWithDistinct

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

        public boolean supportsIndividualTableLocking()
        Description copied from class: DatabasePlatform
        INTERNAL: Indicates whether locking clause could be selectively applied only to some tables in a ReadQuery. Example: the following locks the rows in SALARY table, doesn't lock the rows in EMPLOYEE table: on Oracle platform (method returns true): SELECT t0.EMP_ID..., t1.SALARY FROM EMPLOYEE t0, SALARY t1 WHERE ... FOR UPDATE t1.SALARY on SQLServer platform (method returns true): SELECT t0.EMP_ID..., t1.SALARY FROM EMPLOYEE t0, SALARY t1 WITH (UPDLOCK) WHERE ...
        Overrides:
        supportsIndividualTableLocking in class DatabasePlatform
      • createLocateOperator

        public static ExpressionOperator createLocateOperator()
        INTERNAL: Build locate operator i.e. LOCATE("ob", t0.F_NAME)
      • createLocate2Operator

        public static ExpressionOperator createLocate2Operator()
        INTERNAL: Build locate operator with 3 params i.e. LOCATE("coffee", t0.DESCRIP, 4). Last parameter is a start at.
      • computeMaxRowsForSQL

        public int computeMaxRowsForSQL​(int firstResultIndex,
                                        int maxResults)
        Description copied from class: DatabasePlatform
        INTERNAL: Use the JDBC maxResults and firstResultIndex setting to compute a value to use when limiting the results of a query in SQL. These limits tend to be used in two ways. 1. MaxRows is the index of the last row to be returned (like JDBC maxResults) 2. MaxRows is the number of rows to be returned By default, we assume case 1 and simply return the value of maxResults. Subclasses may provide an override
        Overrides:
        computeMaxRowsForSQL in class DatabasePlatform
        See Also:
        MySQLPlatform
      • shouldOptimizeDataConversion

        public boolean shouldOptimizeDataConversion()
        Description copied from class: DatabasePlatform
        Return if our driver level data conversion optimization is enabled. This can be disabled as some drivers perform data conversion themselves incorrectly.
        Overrides:
        shouldOptimizeDataConversion in class DatabasePlatform
      • buildSelectQueryForSequenceObject

        public ValueReadQuery buildSelectQueryForSequenceObject​(String sequenceName,
                                                                Integer size)
        Description copied from class: DatasourcePlatform
        INTERNAL: Returns query used to read value generated by sequence object (like Oracle sequence). In case the other version of this method (taking no parameters) returns null, this method is called every time sequence object NativeSequence reads. If the platform supportsSequenceObjects then (at least) one of buildSelectQueryForSequenceObject methods should return non-null query.
        Overrides:
        buildSelectQueryForSequenceObject in class DatasourcePlatform
      • supportsGlobalTempTables

        public boolean supportsGlobalTempTables()
        Description copied from class: DatabasePlatform
        INTERNAL: Indicates whether the platform supports global temporary tables. "Global" means that an attempt to create temporary table with the same name for the second time results in exception. EclipseLink attempts to create global temporary table in the beginning of UpdateAllQuery, execution and assumes that it already exists in case SQLException results. In the end of UpdateAllQuery execution all rows are removed from the temporary table - it is necessary in case the same temporary table will be used by another UpdateAllQuery in the same transaction. Override this method if the platform supports global temporary tables. Note that this method is ignored in case supportsLocalTempTables() returns true.
        Overrides:
        supportsGlobalTempTables in class DatabasePlatform
      • getCreateTempTableSqlPrefix

        protected String getCreateTempTableSqlPrefix()
        Description copied from class: DatabasePlatform
        INTERNAL: Override this method if the platform supports temporary tables. This should contain the beginning of sql string for creating temporary table - the sql statement name, for instance: "CREATE GLOBAL TEMPORARY TABLE ". Don't forget to end it with a space.
        Overrides:
        getCreateTempTableSqlPrefix in class DatabasePlatform
      • shouldTempTableSpecifyPrimaryKeys

        protected boolean shouldTempTableSpecifyPrimaryKeys()
        Description copied from class: DatabasePlatform
        INTERNAL: Indicates whether temporary table can specify primary keys (some platforms don't allow that). Used by writeCreateTempTableSql method.
        Overrides:
        shouldTempTableSpecifyPrimaryKeys in class DatabasePlatform
      • getMaxFieldNameSize

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

        public boolean supportsLocalTempTables()
        Description copied from class: DatabasePlatform
        INTERNAL: Indicates whether the platform supports local temporary tables. "Local" means that several threads may create temporary tables with the same name. Local temporary table is created in the beginning of UpdateAllQuery execution and dropped in the end of it. Override this method if the platform supports local temporary tables.
        Overrides:
        supportsLocalTempTables in class DatabasePlatform
      • shouldAlwaysUseTempStorageForModifyAll

        public boolean shouldAlwaysUseTempStorageForModifyAll()
        Description copied from class: DatabasePlatform
        INTERNAL: That method affects UpdateAllQuery and DeleteAllQuery execution. In case it returns false modify all queries would attempt to proceed without using temporary storage if it is possible. In case it returns true modify all queries would use temporary storage unless each modify statement doesn't reference any other tables. May need to override this method if the platform can't handle the sql generated for modify all queries without using temporary storage.
        Overrides:
        shouldAlwaysUseTempStorageForModifyAll in class DatabasePlatform
      • supportsSequenceObjects

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

        public int executeBatch​(Statement statement,
                                boolean isStatementPrepared)
                         throws SQLException
        Description copied from class: DatabasePlatform
        Internal: This gets called on each batch statement execution Needs to be implemented so that it returns the number of rows successfully modified by this statement for optimistic locking purposes.
        Overrides:
        executeBatch in class DatabasePlatform
        isStatementPrepared - - flag is set to true if this statement is prepared
        Returns:
        - number of rows modified/deleted by this statement
        Throws:
        SQLException
      • getInputProcedureToken

        public String getInputProcedureToken()
        Used for stored procedure creation: Prefix for INPUT parameters. Not required on most platforms.
        Overrides:
        getInputProcedureToken in class DatabasePlatform
      • 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
      • appendDate

        protected void appendDate​(Date date,
                                  Writer writer)
                           throws IOException
        Description copied from class: DatabasePlatform
        Answer a platform correct string representation of a Date, suitable for SQL generation. The date is printed in the ODBC platform independent format {d 'yyyy-mm-dd'}.
        Overrides:
        appendDate in class DatabasePlatform
        Throws:
        IOException
      • appendTime

        protected void appendTime​(Time time,
                                  Writer writer)
                           throws IOException
        Description copied from class: DatabasePlatform
        Answer a platform correct string representation of a Time, suitable for SQL generation. The time is printed in the ODBC platform independent format {t'hh:mm:ss'}.
        Overrides:
        appendTime in class DatabasePlatform
        Throws:
        IOException
      • appendTimestamp

        protected void appendTimestamp​(Timestamp timestamp,
                                       Writer writer)
                                throws IOException
        Description copied from class: DatabasePlatform
        Answer a platform correct string representation of a Timestamp, suitable for SQL generation. The timestamp is printed in the ODBC platform independent timestamp format {ts'YYYY-MM-DD HH:MM:SS.NNNNNNNNN'}.
        Overrides:
        appendTimestamp in class DatabasePlatform
        Throws:
        IOException
      • appendCalendar

        protected void appendCalendar​(Calendar calendar,
                                      Writer writer)
                               throws IOException
        Description copied from class: DatabasePlatform
        Answer a platform correct string representation of a Calendar as a Timestamp, suitable for SQL generation. The calendar is printed in the ODBC platform independent timestamp format {ts'YYYY-MM-DD HH:MM:SS.NNNNNNNNN'}.
        Overrides:
        appendCalendar in class DatabasePlatform
        Throws:
        IOException