views:

334

answers:

3

Hello good people i'm just curious about something.I'm using hsql in myproject (embedded of course).At some time i felt the need to visualize what hibernate was generating.I took a free copy of dbvisualizer. here is the hsqljdbc.properties

jdbc.url=jdbc:hsqldb:file:mydb;create=true
hibernate hbm2ddl.auto=create

i downloaded the hsql 1.8.0_10. i did all the required procedure.i could connect and see the tables but after that changes made to the table don't seem be willing to show up.then i've tried to delete the db generate a new one but still.You got any idea in this?

I usually Derby but i've realized lately that it's not that precise about relationship management.I use mysql for the moment which is not good for development so i want to know if i forgot to do something or it's just meant to behave that way.Thanks for reading this

A: 

By default, HSQLDB keeps table contents in memory until the database is shut down: http://www.hsqldb.org/doc/guide/ch05.html#N10DD6

Depending on your needs (eg, working in a development environment) this may be sufficient. For production, however, I'd rather use a DBMS that writes each change to disk in multiple places (which for my means Oracle, although MySQL probably works just as well).

kdgregory
+1  A: 

Why don't you just set the show_sql property to true if you want to see what hibernate does?

jitter
A: 

Using HSQLDB for development and testing is discussed in detail in the new Guide.

http://hsqldb.org/doc/2.0/guide/deployment-chapt.html#N13BC5

HSQLDB uses a write delay mechanism by default and changes are flushed to disk after 10 seconds in version 1.8.x or 0.5 sec in version 2.0.

You can force the database to shutdown and write all the changes when the last connection is closed with this URL:

jdbc.url=jdbc:hsqldb:file:mydb;shutdown=true

With HSQLDB 2.0 you can use the write_delay property to force each commit to write to disk immediately:

jdbc.url=jdbc:hsqldb:file:mydb;hsqldb.write_delay=false

With HSQLDB 1.8, you need to run an SQL command at the beginnig to do this:

SET WRITE_DELAY FALSE

fredt