Wednesday, May 27, 2009

HSQLDB -- Not Inserting Records

Earlier this week one of my interns came to me and showed me some simple code that used Hibernate to insert records into a HSQLDB. I reviewed the code and tried to use the session.flush() method and after that didn't work I re-reveviewed the annotations that mapped the class to the database table. When I couldn't find a problem with the annotations I reviewed the *.script file for the HSQLDB and found an enteresting setting "SET WRITE_DELAY 10". I googled for HSQLDB and WRITE_DELAY and came up with the following article:

It appears that the setting defines a delay between when the insertion sql is executed and when the actuall insert occurs. Since the intern was only executing the insertion and exiting the program and thus there wasn't enough time between the execution of the sql statement adn when the program ended. After we set the write delay value to zero "SET WRITE_DELAY 0" the insertion was persisted every time

No comments:

Post a Comment