@Target(value=METHOD) @Retention(value=RUNTIME) public @interface JavaFunction
SelectQuery
@UserDefinedFunctions
public class UserFunctions {
@JavaFunction
public static String addHello(String value) {
return "Hello "+value;
}
}
Then above function can be used in annotation queries such as
@SelectQuery
@Entity
@SelectQuery(select ssn as id, addHello(concat(firstname, concat(lastname,','))) as full_name, dob as dob FROM myTable)
public class Person {
@Id
private Long id;
private String fullName;
private date dob;
}
Note: functions can be used any where you are writing SQL as part of Entity
definition. For an example see
UserDefinedFunctions
For more information checkout UDF
in Teiid.Modifier and Type | Optional Element and Description |
---|---|
org.teiid.metadata.FunctionMethod.Determinism |
determinism |
boolean |
nullOnNull |
org.teiid.metadata.FunctionMethod.PushDown |
pushdown |
Copyright © 2020. All rights reserved.