Class RangeOverlapsJdbcFunction
- All Implemented Interfaces:
JdbcFunction
Checks whether a calendar event overlaps a window, using the PostgreSQL range type int8range so that
the query can use a range index. Expects exactly 4 arguments:
pathStart and pathEnd have to be references to fields of type long, whereas
windowStart and windowEnd have to be a literal (timestamp in milliseconds).
Both ranges are inclusive on their lower and exclusive on their upper bound ('[)'). Null bounds
are treated as unbounded.
An instantaneous calendar event (same start and end) would be the empty range, which never overlaps anything.
It is therefore built as '[]' instead, so that it matches every window containing its start.
For a good performance a custom index on this expression (e.g. custom_index_calendar_event_range)
has to use the exact same expression.
-
Field Summary
Fields inherited from class AbstractJdbcFunction
returnType -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintgetName()protected voidrender(JdbcFunctionWriter writer, List<? extends org.hibernate.sql.ast.tree.SqlAstNode> arguments) voidvalidateArguments(jakarta.persistence.criteria.Expression<?>[] arguments) Methods inherited from class AbstractJdbcFunction
checkIfFunctionCallOfType, checkIfLiteralOrParameter, checkIfReferenceOfType, createFunction, getFunctionArgumentTypeResolver, getReturnType
-
Constructor Details
-
RangeOverlapsJdbcFunction
-
-
Method Details
-
render
protected void render(JdbcFunctionWriter writer, List<? extends org.hibernate.sql.ast.tree.SqlAstNode> arguments) - Specified by:
renderin classAbstractJdbcFunction
-
getName
-
validateArguments
public void validateArguments(jakarta.persistence.criteria.Expression<?>[] arguments) throws JdbcFunctionException - Throws:
JdbcFunctionException
-
argumentCount
public int argumentCount()- Returns:
- the number of expected arguments.
-