HSQLDialect uses wrong trim() function when running HSQLDB v1.8
---------------------------------------------------------------
Key: HHH-6122
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-6122
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.6.0
Environment: Maven: hibernate-core-3.6.0.Final.jar, hsqldb-1.8.0.10.jar
Reporter: Matthew Pies
The default dialect behavior assumes the TRIM function has the form "TRIM(?1 ?2 ?3
?4)", whereas HSQLDB v1.8 specifies: "TRIM([{LEADING | TRAILING | BOTH}] FROM
<string expression>)"
(
http://www.hsqldb.org/doc/1.8/guide/ch09.html#stored-section).
Simply fixed in the HSQLDialect class constructor by overriding the function registered in
the parent Dialect class:
if ( hsqldbVersion < 20 ) { // maybe == 18? not sure best practice here...
registerFunction("trim", new
SQLFunctionTemplate(StandardBasicTypes.STRING, "trim(both from ?1)"));
}
Simple test case (assuming HSQLDialect + HSQL JDBC driver):
sessionFactory.getCurrentSession().createQuery("from User where trim(email) =
'foo(a)bar.com'").list();
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira