-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: In Memory Database problems with HSQLDB
PostPosted: Wed Jan 28, 2009 4:01 pm 
Newbie

Joined: Thu Jan 22, 2009 6:48 pm
Posts: 5
I'm currently trying to implement an in-memory database using Hibernate Annotations with HSQLDB and I'm running into a problem with Hibernate writing to disk.

Currently I have a small class setup to add a single item into the database. After the transaction, and even after a call for the session to flush to disk, the program exits and nothing gets written to disk. My .log and .script files are empty and show no records of my insert.

A funny thing I noticed is that if I put the thread to sleep... after about 10 seconds of waiting, my transaction is completed and flushed to disk.

I've looked through all the configuration setup properties and tried disabling all caches and any other properties that would prevent Hibernate and HSQLDB from writing to disk, but none of them have worked.

Has anyone run into this before, or have any idea why my flushes won't write to disk?

Here is a copy of my configuration class.....

Code:
AnnotationConfiguration config = new AnnotationConfiguration();
            config.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
            config.setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbcDriver");
            config.setProperty("hibernate.connection.url", "jdbc:hsqldb:file:db/db");
            config.setProperty("hibernate.connection.username", "sa");
            config.setProperty("hibernate.connection.password", "");
            config.setProperty("hibernate.connection.pool_size", "1");
            config.setProperty("hibernate.connection.autocommit", "true");
            config.setProperty("hibernate.cache.provider_class", "org.hibernate.cache.HashtableCacheProvider");
            config.setProperty("hibernate.hbm2ddl.auto", "update");
            config.setProperty("hibernate.show_sql", "true");
            config.setProperty("hibernate.transaction.factory_class", "org.hibernate.transaction.JDBCTransactionFactory");
            config.setProperty("hibernate.current_session_context_class", "thread");
            config.setProperty("hibernate.cache.use_second_level_cache","false");

            // Add your mapped classes here:
            config.addAnnotatedClass(DummyClass.class);

            sessionFactory = config.buildSessionFactory();


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 02, 2009 5:34 pm 
Newbie

Joined: Thu Jan 22, 2009 6:48 pm
Posts: 5
in case anyone else decides to not thoroughly read the HSQLDB documentation and runs into this.... The problem was that in order to flush a HSQLDB session to disk a SHUTDOWN query must be executed before shutting down.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.