javamysqlhsqldbprimavera

str_to_date mysql does not run in hsql


My code is performing the following update at a given time in my mysql database:

" UPDATE client_registration "  +
" SET registration_date = NOW() "  +
" WHERE cycle <= str_to_date(\"" + now + "\",'%d/%m/%Y %H:%i') "; 

However I have a unit test that tries to perform this update on the HSQL database and I receive the following error message: user lacks privilege or object not found: STR_TO_DATE.

Some way to execute the condition WHERE cycle_start <= str_to_date(\"" + now + "\",'%d/%m/%Y %H:%i') for the mysql database and the hsql database?


Solution

  • You have to re-write your query for HSQL:

    " UPDATE client_registration "  +
    " SET registration_date = NOW() "  +
    " WHERE cycle <= current_timestamp"; 
    

    How to do "select current_timestamp" in hsqldb?