<< crypt() function & windows | Home | Stripes 1.4.3 released >>

Hsql, ClassCastException and to_char

Are you trying to write tests for an oracle based java application using the HSQLDB (Version 1.8.0.7)? Ever encountered ClassCastExceptions in statements that are using the to_char function?

This Error indicates that you are using the to_char function in a statement with a non Date first argument. When looking into the hsqldb source code this becomes obvious: org.hsqldb.Library has a to_char method with the following signature:

So it looks like you have to create your own to_char implementation. Create an appropriate alias as described in the HSQL documentation:

With a to_char method that could look like this:




Add a comment Send a TrackBack