Module io.ebean.api

Class DbViewHistorySupport

java.lang.Object
io.ebean.config.dbplatform.DbViewHistorySupport
All Implemented Interfaces:
DbHistorySupport

public abstract class DbViewHistorySupport extends Object implements DbHistorySupport
Database view based implementation of DbHistorySupport.

These implementations have explicit history tables, a view to union the base table and history table and triggers to maintain the history.

  • Constructor Details

    • DbViewHistorySupport

      public DbViewHistorySupport()
  • Method Details

    • isStandardsBased

      public boolean isStandardsBased()
      Description copied from interface: DbHistorySupport
      Return true if the implementation is SQL2011 standards based.

      Non standards based means we need to add additional predicates into the JOIN ON clause and add an additional predicate for the base table.

      Specified by:
      isStandardsBased in interface DbHistorySupport
    • getAsOfViewSuffix

      public String getAsOfViewSuffix(String asOfViewSuffix)
      Returns the configured view suffix.
      Specified by:
      getAsOfViewSuffix in interface DbHistorySupport
      Parameters:
      asOfViewSuffix - the configured view suffix (typically "_with_history").
      Returns:
      The suffix appended after the base table name in the from and join clauses.
    • getVersionsBetweenSuffix

      public String getVersionsBetweenSuffix(String asOfViewSuffix)
      Returns the configured view suffix (same as getAsOfViewSuffix()).
      Specified by:
      getVersionsBetweenSuffix in interface DbHistorySupport
      Parameters:
      asOfViewSuffix - the configured view suffix (typically "_with_history").
    • getBindCount

      public int getBindCount()
      Return 2 if we have effective start and effective end as 2 columns. Note that for postgres we can use a single range type so that returns 1.
      Specified by:
      getBindCount in interface DbHistorySupport
    • getAsOfPredicate

      public String getAsOfPredicate(String asOfTableAlias, String asOfSysPeriod)
      Return the 'as of' predicate clause appended to the end of the normal query predicates.
      Specified by:
      getAsOfPredicate in interface DbHistorySupport
      Parameters:
      asOfTableAlias - The table alias this predicate is added for
      asOfSysPeriod - The name of the 'sys_period' column used for effective date time range.
      Returns:
      The predicate containing a single ? bind parameter which will be bound to the 'as at' timestamp value
    • getSysPeriodLower

      public String getSysPeriodLower(String tableAlias, String sysPeriod)
      Return the lower bound column prepended with the table alias.
      Specified by:
      getSysPeriodLower in interface DbHistorySupport
      Parameters:
      tableAlias - the table alias
      sysPeriod - the name of the sys_period column
    • getSysPeriodUpper

      public String getSysPeriodUpper(String tableAlias, String sysPeriod)
      Return the upper bound column prepended with the table alias.
      Specified by:
      getSysPeriodUpper in interface DbHistorySupport
      Parameters:
      tableAlias - the table alias
      sysPeriod - the name of the sys_period column