Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HSQLDB is eating all my memory

Tags:

java

jpa

hsqldb

I'm using a HSQLDB for an application that stores research data and there is quite a lot of data. HSQLDB insists on always loading the tables into memory. I've tried fixing this by setting hsqldb.default_table_type=cached in my persistence.xml but that does not work.

Is this the wrong place?

persistence.xml

<persistence-unit name="Dvh DB" transaction-type="RESOURCE_LOCAL">
    <class>com.willcodejavaforfood.dvh.entity.Patient</class>
    <class>com.willcodejavaforfood.dvh.entity.Plan</class>
    <class>com.willcodejavaforfood.dvh.entity.Dvh</class>
    <class>com.willcodejavaforfood.dvh.entity.ImportSession</class>
    <class>com.willcodejavaforfood.dvh.entity.Project</class>
    <class>com.willcodejavaforfood.dvh.entity.Course</class>
    <class>com.willcodejavaforfood.dvh.entity.Property</class>
    <properties>
        <property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:./myDvhDb"/>
        <property name="javax.persistence.jdbc.user" value="sa"/>
        <property name="javax.persistence.jdbc.password" value=""/>
        <property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
        <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" />
        <property name="hibernate.hbm2ddl.auto" value="create-drop" />
        <property name="hsqldb.default_table_type" value="cached" />
    </properties>
</persistence-unit>

When my HSQLDB database is created I can see in its properties file:

hsqldb.default_table_type=memory

Thanks

like image 487
willcodejavaforfood Avatar asked Oct 08 '10 09:10

willcodejavaforfood


1 Answers

Could you try putting the hsqldb.default_table_type=cached in the connection string? Like this: jdbc:hsqldb:./myDvhDb;hsqldb.default_table_type=cached

like image 132
Petar Minchev Avatar answered Sep 21 '22 19:09

Petar Minchev