jjYBdx4IL / hibernate-examples

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Hibernate Examples

I prefer H2 to Derby because the Derby devs refused to add 'DROP TABLE ... IF EXISTS' semantics despite many user complaints simply because it is not part of some SQL standard.That, however, clutters tests with useless SQLExceptions when instantiating tables.

In addition to that, H2 also does not create log files (derby.log) by default in random directories like the current working directory.

Second Level Caching And Statistics Gathering

The H2 and HSQL examples include second level caching and use statistics functionality to verify its operation.

Update

H2 supports the command "SHUTDOWN COMPACT". It revealed an annoying leak that prevents BLOBs from getting freed when their data rows get deleted (v1.4.196). It's possible to work around this by re-creating the database (SCRIPT TO/RUNSCRIPT FROM), but H2 also does not support SERIALIZABLE isolation level, so I decided to switch to HSQL.

HSQL also supports "SHUTDOWN COMPACT". It works nicely with BLOBs, but you need to run the "CHECKPOINT" SQL command if those blobs have not been checkpointed yet (ie. merged into the main database file(s)). HSQL also uses more than one file, so it's a good idea to place the main database file as given on the connection string in its own directory.

H2 and HSQL both have a GUI that can be started simply by running their respective database driver jars.

HSQL connection url to use MVCC/serializable isolation:

jdbc:hsqldb:file:dbdir/db;hsqldb.tx=mvcc;hsqldb.tx_level=SERIALIZABLE

-- Build Status devel/java/github/hibernate-examples@7185

-- Build Status devel/java/github/hibernate-examples@7851

About


Languages

Language:Java 100.0%