#347 - @History support with query.asOf(Timestamp) - javadoc update

This commit is contained in:
Robin Bygrave
2015-07-24 10:24:28 +12:00
parent 82489636d5
commit 3a547bf487
3 changed files with 24 additions and 0 deletions
@@ -442,6 +442,13 @@ public class DatabasePlatform {
return disallowBatchOnCascade;
}
/**
* Return the 'as of' predicate added for the given table alias.
*
* @param asOfTableAlias The table alias this predicate is added for
* @param asOfSysPeriod The name of the 'sys_period' column used for effective date time range.
* @return The predicate containing a single ? bind parameter which will be bound to the 'as at' timestamp value
*/
public String getAsOfPredicate(String asOfTableAlias, String asOfSysPeriod) {
throw new RuntimeException("AsOf query not support of this database platform yet");
}
@@ -50,6 +50,21 @@ public class Postgres8Platform extends DatabasePlatform {
}
/**
* Build and return the 'as of' predicate for a given table alias.
* <p>
* Each @History entity involved in the query has this predicate added using the related table alias.
* </p>
*/
public String getAsOfPredicate(String asOfTableAlias, String asOfSysPeriod) {
// for Postgres we are using the 'timestamp with timezone range' data type
// as our sys_period column so hence the predicate below
StringBuilder sb = new StringBuilder(40);
sb.append(asOfTableAlias).append(".").append(asOfSysPeriod).append(" @> ?::timestamptz");
return sb.toString();
}
/**
* Create a Postgres specific sequence IdGenerator.
*/
@@ -68,6 +68,8 @@ public class PostgresPlatform extends DatabasePlatform {
*/
public String getAsOfPredicate(String asOfTableAlias, String asOfSysPeriod) {
// for Postgres we are using the 'timestamp with timezone range' data type
// as our sys_period column so hence the predicate below
StringBuilder sb = new StringBuilder(40);
sb.append(asOfTableAlias).append(".").append(asOfSysPeriod).append(" @> ?::timestamptz");
return sb.toString();