something funny with embedded hsql

≯℡__Kan透↙ 提交于 2019-12-08 01:10:49

问题


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


回答1:


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

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

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 and later.

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.x 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

Version 2.2.9 and later persist the latest changes when the last connection is closed, so it may not be necessary to use hsqldb.write_delay=false for tests that close the connections.

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

SET WRITE_DELAY FALSE




回答2:


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).




回答3:


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



来源:https://stackoverflow.com/questions/1723861/something-funny-with-embedded-hsql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!