Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Hibernate Hibernate4 hibernate hsql

Related Tutorials


 
 

Share on Google+Share on Google+

hibernate hsql

Advertisement
In this section, you will learn HSQLDB connection using Hibernate.

hibernate hsql

In this section, you will learn HSQLDB connection using Hibernate.

HSQL

HSQL stands for Hyper Structured Query Language. HSQL is the structured query language of HSQLDB(Hyper Structured Query Language Database) which is a relational database system written in Java. It has a JDBC driver . HSQLDB is recognized for its small size ,flexibility,speed and its ability to execute completely or partly in memory.

For connecting to HSQLDB , you need to download  hsqldb-2.2.8.jar file from here.

The hibernate.cfg.xml should have following configuration for using HSQLDB :

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
<!-- Database connection settings -->
<property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="connection.url">jdbc:hsqldb:mem:anky</property>
<property name="connection.username">root</property>
<property name="connection.password">root</property>

<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">2</property>

<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.HSQLDialect</property>

<!-- Echo all executed SQL to stdout --> 
<property name="show_sql">true</property>

<!-- Drop and re-create the database schema on startup 
<property name="hbm2ddl.auto">create</property>

<mapping resource="net/roseindia/Worker.hbm.xml"/>
</session-factory>
</hibernate-configuration>

NOTE :Except the above configuration all the codes are same for using Hibernate to connect to HSQL database.

For complete tutorial on Hibernate 4 click here .

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 9, 2012

Related Tutorials

Discuss: hibernate hsql  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com