Java Reference
In-Depth Information
To open a new Eclipse perspective, you can either select the Window รค Open Perspective
menu option or click the Open Perspective icon.
Select the Other option from the resulting menu. This will present you with the list of
available perspectives. Select the Hibernate Console option from the resulting dialog.
Much as when entering the Eclipse debugging perspective, the layout of Eclipse will change,
with various Hibernate-specific views being opened (although you will still have access to the
Package Explorer as one of the tabbed options behind the new Hibernate configuration view).
To switch between the perspectives, you can select the Java or Hibernate Console per-
spective icons on the top right of the main Eclipse window (you may need to adjust the menu
layout slightly if these are obscured). Figure B-7 shows the icons for the Hibernate Console
and Java perspectives, with the Java perspective selected.
Figure B-7. The Java and Hibernate Console perspective icons, with the Java perspective
currently selected
Using the Hibernate Console
With the project set up and the Hibernate Console perspective added to Eclipse, you can now
start using some of the Hibernate Tools plug-in features more directly.
Creating a Hibernate Console Configuration
The Hibernate Console represents a view onto the Hibernate object store. It therefore needs
the same basic configuration information as any other client of Hibernate. You will need a
Hibernate XML configuration file and/or a properties file (see Listing B-1).
Listing B-1. The Configuration File Used in Our Example: hibernate.cfg.xml
<?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>
<!-- The database settings -->
<property name="hibernate.connection.driver_class">
org.hsqldb.jdbcDriver
</property>
<property name="hibernate.connection.url">
jdbc:hsqldb:file: /workspace/ToolsExample/db/annotationsdb ;shutdown=true
</property>
Search WWH ::




Custom Search