Monday, August 3, 2009

Eclipse doesn't include Hibernate XML HBM files in JAR

Recently we had a problem at work where the JARs created by Eclpise didn't contain the *.hbm.xml files that are required for mapping. After some investigation one of the developers found a setting within Eclipse by doing the following:

1) Click on Window --> Preferences
2) Click on the plus sign next to Java
3) Click on the plus sign next to the compiler option
4) Click on the "Building" option
5) Under the "Output Folder" option there are a list of "Filtered Resources." Take *.xml out of that list.

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