[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6840) to_char function with hsqldb doesn't work
Roozbeh Maadani (JIRA)
noreply at atlassian.com
Tue Nov 22 11:18:19 EST 2011
to_char function with hsqldb doesn't work
-----------------------------------------
Key: HHH-6840
URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6840
Project: Hibernate Core
Issue Type: Bug
Components: query-hql
Affects Versions: 3.6.8
Environment: Hibernate 3.6.8.Final and HSQLDB 2.2.4
Reporter: Roozbeh Maadani
Priority: Minor
Hi,
We are developing a project which uses hibernate 3.6.8.final , Oracle 10g database in production and a in-memory Hsqldb for unittests. In our hql queries, we use "to_char" function which should work both for Oracle 10g and Hsqldb version 2.2 and above. There is no problem in production (Oracle10gDialect) but when we run the tests (for tests we use HSQLDialect ) we get the following mystic error:
org.hsqldb.HsqlException: user lacks privilege or object not found: TO_CHAR
And it is possible to see in the logs that HSQLDialect doesn't generate correct sql.
After tracing the code I found out that HSQLDialect doesn't register "to_char" function for hsqldb 2.2.x. The following code solved the problem:
public class MyHSQLDialect extends HSQLDialect
{
public MyHSQLDialect()
{
super();
registerFunction( "to_char", new StandardSQLFunction( "to_char" ) );
}
}
I suppose it is possible to move this code to the HSQLDialect constructor and solve this issue.
Regards,
Roozbeh Maadani
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the hibernate-issues
mailing list