Annotation Type QuerySqlFunction
-
@Documented @Retention(RUNTIME) @Target(METHOD) public @interface QuerySqlFunction
Annotates public static methods in classes to be used in SQL queries as custom functions. Annotated class must be registered in H2 indexing SPI using following methodCacheConfiguration.setSqlFunctionClasses(Class[])
.Example usage:
public class MyFunctions { @QuerySqlFunction public static int sqr(int x) { return x * x; } } // Register. indexing.setSqlFunctionClasses(MyFunctions.class); // And use in queries. cache.queries().createSqlFieldsQuery("select sqr(2) where sqr(1) = 1");
For more information about H2 custom functions please refer to H2 documentation.
-
-
Optional Element Summary
Optional Elements Modifier and Type Optional Element Description String
alias
Specifies alias for the function to be used form SQL queries.boolean
deterministic
Specifies if the function is deterministic (result depends only on input parameters).
-
-
-
Element Detail
-
alias
String alias
Specifies alias for the function to be used form SQL queries. If no alias provided method name will be used.- Returns:
- Alias for function.
- Default:
- ""
-
-
-
deterministic
boolean deterministic
Specifies if the function is deterministic (result depends only on input parameters).Deterministic function is a function which always returns the same result assuming that input parameters are the same.
- Returns:
true
If function is deterministic,false
otherwise.
- Default:
- false
-
-