Package io.ebean.config.dbplatform
Class DbViewHistorySupport
- java.lang.Object
-
- io.ebean.config.dbplatform.DbViewHistorySupport
-
- All Implemented Interfaces:
DbHistorySupport
- Direct Known Subclasses:
H2HistorySupport
,MySqlHistorySupport
,NuoDbHistorySupport
,PostgresHistorySupport
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 Summary
Constructors Constructor Description DbViewHistorySupport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getAsOfPredicate(String asOfTableAlias, String asOfSysPeriod)
Return the 'as of' predicate clause appended to the end of the normal query predicates.String
getAsOfViewSuffix(String asOfViewSuffix)
Returns the configured view suffix.int
getBindCount()
Return 2 if we have effective start and effective end as 2 columns.String
getSysPeriodLower(String tableAlias, String sysPeriod)
Return the lower bound column prepended with the table alias.String
getSysPeriodUpper(String tableAlias, String sysPeriod)
Return the upper bound column prepended with the table alias.String
getVersionsBetweenSuffix(String asOfViewSuffix)
Returns the configured view suffix (same as getAsOfViewSuffix()).boolean
isStandardsBased()
Return true if the implementation is SQL2011 standards based.
-
-
-
Constructor Detail
-
DbViewHistorySupport
public DbViewHistorySupport()
-
-
Method Detail
-
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 interfaceDbHistorySupport
-
getAsOfViewSuffix
public String getAsOfViewSuffix(String asOfViewSuffix)
Returns the configured view suffix.- Specified by:
getAsOfViewSuffix
in interfaceDbHistorySupport
- 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 interfaceDbHistorySupport
- 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 interfaceDbHistorySupport
-
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 interfaceDbHistorySupport
- Parameters:
asOfTableAlias
- The table alias this predicate is added forasOfSysPeriod
- 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 interfaceDbHistorySupport
- Parameters:
tableAlias
- the table aliassysPeriod
- 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 interfaceDbHistorySupport
- Parameters:
tableAlias
- the table aliassysPeriod
- the name of the sys_period column
-
-