Class BaseTable

    • Field Detail

      • lockDepth

        protected int lockDepth
        Keeps track of the locks on a table since calls to lock the table can be nested.
    • Constructor Detail

      • BaseTable

        public BaseTable​(JdbcTemplate jdbcTemplate,
                         Database database,
                         Schema schema,
                         String name)
        Parameters:
        jdbcTemplate - The JDBC template for communicating with the DB.
        database - The database-specific support.
        schema - The schema this table lives in.
        name - The name of the table.
    • Method Detail

      • exists

        public final boolean exists()
        Specified by:
        exists in interface Table
      • doExists

        protected abstract boolean doExists()
                                     throws SQLException
        Checks whether this table exists.
        Throws:
        SQLException - when the check failed.
      • exists

        protected boolean exists​(@Nullable Schema catalog,
                                 @Nullable Schema schema,
                                 String table,
                                 String... tableTypes)
                          throws SQLException
        Checks whether the database contains a table matching the given criteria.
        Parameters:
        catalog - The catalog where the table resides. (optional)
        schema - The schema where the table resides. (optional)
        table - The name of the table. (optional)
        tableTypes - The types of table to look for (e.g. TABLE). (optional)
        Throws:
        SQLException - when the check failed.
      • lock

        public void lock()
        Description copied from interface: Table
        Locks this table in this schema using a read/write pessimistic lock until the end of the current transaction. Note that unlock() still needs to be called even if your database unlocks the table implicitly (in which case doUnlock() may be a no-op) in order to maintain the lock count correctly.
        Specified by:
        lock in interface Table
      • doLock

        protected abstract void doLock()
                                throws SQLException
        Locks this table in this schema using a read/write pessimistic lock until the end of the current transaction. Note that unlock() still needs to be called even if your database unlocks the table implicitly (in which case doUnlock() may be a no-op) in order to maintain the lock count correctly.
        Throws:
        SQLException - when this table in this schema could not be locked.
      • unlock

        public void unlock()
        Description copied from interface: Table
        For databases that require an explicit unlocking, not an implicit end-of-transaction one.
        Specified by:
        unlock in interface Table
      • doUnlock

        protected void doUnlock()
                         throws SQLException
        For databases that require an explicit unlocking, not an implicit end-of-transaction one.
        Throws:
        SQLException - when this table in this schema could not be unlocked.