Search in sources :

Example 1 with Template

use of com.querydsl.core.types.Template in project querydsl by querydsl.

the class DialectSupport method createFunction.

public static SQLFunction createFunction(SQLTemplates templates, Operator operator) {
    Template template = templates.getTemplate(operator);
    Type type = HibernateUtil.getType(operator.getType());
    return new SQLFunctionTemplate(type, convert(template));
}
Also used : Type(org.hibernate.type.Type) SQLFunctionTemplate(org.hibernate.dialect.function.SQLFunctionTemplate) Template(com.querydsl.core.types.Template) SQLFunctionTemplate(org.hibernate.dialect.function.SQLFunctionTemplate)

Example 2 with Template

use of com.querydsl.core.types.Template in project querydsl by querydsl.

the class DialectSupportTest method convert.

@Test
public void convert() {
    Template trim = HSQLDBTemplates.DEFAULT.getTemplate(Ops.TRIM);
    assertEquals("trim(both from ?1)", DialectSupport.convert(trim));
    Template concat = HSQLDBTemplates.DEFAULT.getTemplate(Ops.CONCAT);
    assertEquals("?1 || ?2", DialectSupport.convert(concat));
}
Also used : Template(com.querydsl.core.types.Template) Test(org.junit.Test)

Aggregations

Template (com.querydsl.core.types.Template)2 SQLFunctionTemplate (org.hibernate.dialect.function.SQLFunctionTemplate)1 Type (org.hibernate.type.Type)1 Test (org.junit.Test)1