HiberObjects

Download

Order

Forum

Vote for this plugin

Connect to Database

JDBC Drivers

HiberObjects can use any database that is supported by Hibernate. This is configured with the hibernate.dialect property in hibernate.properties. See Hibernate SQL Dialects for a complete list of legal values.

You also need to add the JDBC driver for the database to the project, only the driver for HSQLDB can be added automatically.

Although any JDBC driver can be used for execution, only a limited number of predefined JDBC drivers are supported for database import.

Run HSQLDB

The following ps shows how to connect to an HSQLDB database called mydatabase.

Configure the database in hibernate.properties:

hibernate.connection.url=jdbc:hsqldb:hsql://localhost/mydatabase

Launch org.hsqldb.Server as a Java Application and give the following arguments: -database.0 mydatabase -dbname.0 mydatabase
Select Run -> Run..., select Java Application and New. Select the current project and the main class org.hsqldb.Server.

Push Arguments and type the following Program arguments: -database.0 mydatabase -dbname.0 mydatabase

Create Database Schema

Run HibernateHelper as a Java application to create the database schema for mydatabase. All Persistent classes will be generated as a table with columns for attributes and relations.

Be careful! This will overwrite old data.

If an argument is given to HibernateHelper, the schema will be stored in a file with the specified name instead.

Run HSQLDB Client

Launch org.hsqldb.util.DatabaseManager as a Java Application to start a simple client. Select Type: HSQL Database Engine Server and URL: jdbc:hsqldb:hsql://localhost/mydatabase

This will open a simple client application where you can enter SQL statements.

If you configure Hibernate to use HSQLDB server, you can debug your application while you read or modify the database in this client. Just remember that changes to persistent objects are not saved in the database until the transaction is comitted or flushed.