Error in filter-def condition attribute definition caused by trim sql function

Description

I have encountered an error that in filter-def definition in condition attribute is not possible to use SQL function trim with expression.
For example this definition: <filter-def name="concatInTrim" condition="TRIM(CONCAT(TITLE,TITLE)) IS NOT NULL" /> causes this error:

------------------------------------------------------------------------------- Test set: org.hibernate.test.function.trim.FunctionTrimTest
------------------------------------------------------------------------------- Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.698 sec <<< FAILURE!
testBasicUsage(org.hibernate.test.function.trim.FunctionTrimTest) Time elapsed: 0.659 sec <<< ERROR!
org.hibernate.HibernateException: Unexpected number of trim function operands : 5
at org.hibernate.sql.Template$TrimOperands.<init>(Template.java:582)
at org.hibernate.sql.Template$TrimOperands.<init>(Template.java:561)
at org.hibernate.sql.Template.renderWhereStringTemplate(Template.java:248)
at org.hibernate.util.FilterHelper.<init>(FilterHelper.java:63)
at org.hibernate.persister.entity.AbstractEntityPersister.<init>(AbstractEntityPersister.java:737)
at org.hibernate.persister.entity.SingleTableEntityPersister.<init>(SingleTableEntityPersister.java:133)
at org.hibernate.persister.PersisterFactory.createClassPersister(PersisterFactory.java:84)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:284)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1842)
at org.hibernate.test.function.trim.FunctionTrimTest.setUp(FunctionTrimTest.java:24)
at junit.framework.TestCase.runBare(TestCase.java:132)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:59)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:115)
at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:102)
at org.apache.maven.surefire.Surefire.run(Surefire.java:180)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:350)
at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1021)

I think, that this problem is caused by function org.hibernate.sql.Template.renderWhereStringTemplate(), that doesn't take into account possibility of expression in trim function argument.
I think that this problem is related to http://opensource.atlassian.com/projects/hibernate/browse/HHH-5676?page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#issue-tabs.
In attachment is test case based on Hibernate tutorial (hbm.xml Tutorial).

Environment

None

Activity

Show:
Tomáš Šafařík
March 2, 2011, 2:05 PM

Project with test case

Brett Meyer
April 7, 2014, 5:42 PM

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.

Thank you!

Brett Meyer
July 8, 2014, 3:10 PM

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!

Assignee

Unassigned

Reporter

Tomáš Šafařík

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure