Class JdbcAdapter

    • Field Detail

      • supportsBatchUpdates

        protected boolean supportsBatchUpdates
      • supportsUniqueConstraints

        protected boolean supportsUniqueConstraints
      • supportsGeneratedKeys

        protected boolean supportsGeneratedKeys
      • caseInsensitiveCollations

        protected boolean caseInsensitiveCollations
      • batchQueryBuilderFactory

        protected BatchTranslatorFactory batchQueryBuilderFactory
        Deprecated.
        since 4.0 BatchQueryBuilderfactory is attached to the DataNode.
        Since:
        3.1
    • Method Detail

      • getBatchTerminator

        public String getBatchTerminator()
        Returns default separator - a semicolon.
        Specified by:
        getBatchTerminator in interface DbAdapter
        Since:
        1.0.4
      • getJdbcEventLogger

        public JdbcEventLogger getJdbcEventLogger()
        Since:
        3.1
      • findResource

        protected URL findResource​(String name)
        Locates and returns a named adapter resource. A resource can be an XML file, etc.

        This implementation is based on the premise that each adapter is located in its own Java package and all resources are in the same package as well. Resource lookup is recursive, so that if DbAdapter is a subclass of another adapter, parent adapter package is searched as a failover.

        Since:
        3.0
      • createPkGenerator

        protected PkGenerator createPkGenerator()
        Creates and returns a primary key generator. This factory method should be overriden by JdbcAdapter subclasses to provide custom implementations of PKGenerator.
      • createEJBQLTranslatorFactory

        protected EJBQLTranslatorFactory createEJBQLTranslatorFactory()
        Creates and returns an EJBQLTranslatorFactory used to generate visitors for EJBQL to SQL translations. This method should be overriden by subclasses that need to customize EJBQL generation.
        Since:
        3.0
      • getPkGenerator

        public PkGenerator getPkGenerator()
        Returns primary key generator associated with this DbAdapter.
        Specified by:
        getPkGenerator in interface DbAdapter
      • setPkGenerator

        public void setPkGenerator​(PkGenerator pkGenerator)
        Sets new primary key generator.
        Since:
        1.1
      • setSupportsUniqueConstraints

        public void setSupportsUniqueConstraints​(boolean flag)
        Since:
        1.1
      • typeSupportsLength

        public boolean typeSupportsLength​(int type)
        Returns true if supplied type can have a length attribute as a part of column definition
        Specified by:
        typeSupportsLength in interface DbAdapter
        Since:
        4.0
      • createTable

        public String createTable​(DbEntity entity)
        Returns a SQL string that can be used to create database table corresponding to ent parameter.
        Specified by:
        createTable in interface DbAdapter
      • createTableAppendPKClause

        protected void createTableAppendPKClause​(StringBuffer sqlBuffer,
                                                 DbEntity entity)
        Since:
        1.2
      • externalTypesForJdbcType

        public String[] externalTypesForJdbcType​(int type)
        Description copied from interface: DbAdapter
        Returns an array of RDBMS types that can be used with JDBC type. Valid JDBC types are defined in java.sql.Types.
        Specified by:
        externalTypesForJdbcType in interface DbAdapter
      • getExtendedTypes

        public ExtendedTypeMap getExtendedTypes()
        Description copied from interface: DbAdapter
        Returns a map of ExtendedTypes that is used to translate values between Java and JDBC layer.
        Specified by:
        getExtendedTypes in interface DbAdapter
      • buildAttribute

        public DbAttribute buildAttribute​(String name,
                                          String typeName,
                                          int type,
                                          int size,
                                          int scale,
                                          boolean allowNulls)
        Description copied from interface: DbAdapter
        Creates and returns a DbAttribute based on supplied parameters (usually obtained from database meta data).
        Specified by:
        buildAttribute in interface DbAdapter
        Parameters:
        name - database column name
        typeName - database specific type name, may be used as a hint to determine the right JDBC type.
        type - JDBC column type
        size - database column size (ignored if less than zero)
        scale - database column scale, i.e. the number of decimal digits (ignored if less than zero)
        allowNulls - database column nullable parameter
      • tableTypeForTable

        public String tableTypeForTable()
        Description copied from interface: DbAdapter
        Returns the name of the table type (as returned by DatabaseMetaData.getTableTypes) for a simple user table.
        Specified by:
        tableTypeForTable in interface DbAdapter
      • tableTypeForView

        public String tableTypeForView()
        Description copied from interface: DbAdapter
        Returns the name of the table type (as returned by DatabaseMetaData.getTableTypes) for a view table.
        Specified by:
        tableTypeForView in interface DbAdapter
      • supportsBatchUpdates

        public boolean supportsBatchUpdates()
        Description copied from interface: DbAdapter
        Returns true if the target database supports batch updates.
        Specified by:
        supportsBatchUpdates in interface DbAdapter
      • setSupportsBatchUpdates

        public void setSupportsBatchUpdates​(boolean flag)
      • supportsGeneratedKeys

        public boolean supportsGeneratedKeys()
        Description copied from interface: DbAdapter
        Returns true if a target database supports key autogeneration. This feature also requires JDBC3-compliant driver.
        Specified by:
        supportsGeneratedKeys in interface DbAdapter
        Since:
        1.2
      • setSupportsGeneratedKeys

        public void setSupportsGeneratedKeys​(boolean flag)
        Since:
        1.2
      • setEjbqlTranslatorFactory

        public void setEjbqlTranslatorFactory​(EJBQLTranslatorFactory ejbqlTranslatorFactory)
        Sets a translator factory for EJBQL to SQL translation. This property is normally initialized in constructor by calling createEJBQLTranslatorFactory(), so users would only override it if they need to customize EJBQL translation.
        Since:
        3.0
      • createQuotingStrategy

        protected QuotingStrategy createQuotingStrategy()
        Returns:
        Since:
        4.0
      • getBatchQueryBuilderFactory

        @Deprecated
        public BatchTranslatorFactory getBatchQueryBuilderFactory()
        Deprecated.
        since 4.0 BatchQueryBuilderfactory is attached to the DataNode.
        Since:
        3.1
      • setBatchQueryBuilderFactory

        @Deprecated
        public void setBatchQueryBuilderFactory​(BatchTranslatorFactory batchQueryBuilderFactory)
        Deprecated.
        since 4.0 BatchQueryBuilderfactory is attached to the DataNode.
        Since:
        3.1
      • unwrap

        public DbAdapter unwrap()
        Simply returns this, as JdbcAdapter is not a wrapper.
        Specified by:
        unwrap in interface DbAdapter
        Since:
        4.0