HQL query clauses:
column1 LIKE CONCAT(CONCAT('%', REPLACE(:matchString, '%', '%%')), '%')
column1 LIKE '%' || REPLACE(:matchString, '%', '%%') || '%'
t0_.column1 like '%'||REPLACE(?||'%'||'%%')||'%'
used dialect org.hibernate.dialect.DB2Dialect does not have "replace" as a registered function.
"concat" is registered as a org.hibernate.dialect.function.VarArgsSQLFunction with "||" separator.
invoked render method org.hibernate.hql.ast.SqlGenerator.beginFunctionTemplate(AST, AST) does put org.hibernate.hql.ast.SqlGenerator.FunctionArguments writer on stack for outer concat method
2. invocation of render method org.hibernate.hql.ast.SqlGenerator.beginFunctionTemplate(AST, AST) does NOT put a new FunctionsArgments writer on stack, NOR does it put the org.hibernate.hql.ast.SqlGenerator.DefaultWriter back on the stack --> outer concat method FunctionArguments writer captures replace method call output parts as its arguments: "replace(?", "'%'", "'%%')"
suggestion: in case of template == null, let org.hibernate.hql.ast.SqlGenerator.beginFunctionTemplate(AST, AST) put a new DefaultWriter on the stack, and org.hibernate.hql.ast.SqlGenerator.endFunctionTemplate(AST) remove it again.
workaround by subclassing dialect and registering "replace" function template, but still, other unregistered functions would be treated improperly.
eclipse vardump of functionArgments on org.hibernate.hql.ast.SqlGenerator.endFunctionTemplate(AST) for concat
Java version: 1.6.0_16,Sun Microsystems Inc.
Java VM: Java HotSpot(TM) 64-Bit Server VM 14.2-b01,Sun Microsystems Inc.
OS-System: Linux 22.214.171.124-69.fc8,amd64
DB2 v8 / JDBC Driver v4.7.85
In an effort to clean up, in bulk, tickets that are most likely out of date, we're transitioning all ORM 3 tickets to an "Awaiting Test Case" state. Please see http://in.relation.to/Bloggers/HibernateORMJIRAPoliciesAndCleanUpTactics for more information.
If this is still a legitimate bug in ORM 4, please provide either a test case that reproduces it or enough detail (entities, mappings, snippets, etc.) to show that it still fails on 4. If nothing is received within 3 months or so, we'll be automatically closing them.
Bulk rejecting stale issues. If this is still a legitimate issue on ORM 4, feel free to comment and attach a test case. I'll address responses case-by-case. Thanks!