Java Reference
In-Depth Information
<property name="hibernate.dialect">
org.hibernate.dialect.HSQLDialect
</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password"/>
<property name="hibernate.connection.pool_size">0</property>
<property name="show_sql">false</property>
<!-- The class mappings for our example -->
<mapping class="com.hibernatebook.tools.Note"/>
<mapping class="com.hibernatebook.tools.Notepad"/>
</session-factory>
</hibernate-configuration>
If you are using the HSQLDB database in conjunction with Hibernate Tools, we recom-
mend that you use fully qualified path names (shown in bold in the preceding code) to avoid
possible clashes between the working directories and classpaths used by Ant, the Eclipse IDE,
and the Hibernate Console. In our example, we will be working with the annotations-based
mappings, so we use the mapping element with a class attribute to determine the mapped
classes. However, the console configuration will automatically find any correctly annotated
entity classes using reflection, so it is possible to omit these entries.
If you choose to use XML-based mappings, you can use the file attribute to specify the
mapping file instead, or specify the paths to the mapping files in the Hibernate configuration
entry used by the Hibernate Console.
Hibernate Tools provides a wizard to create the Hibernate configuration entry. To use the
wizard, select the File ä New ä Hibernate Console Configuration menu option, as shown in
Figure B-8.
Figure B-8. Creating a new console configuration
This will bring up the Create Hibernate Console Configuration dialog page. This consists
of a simple form with three basic sections. In the first part of the form shown in Figure B-9, set
a suitable name for this configuration and the path to the Hibernate configuration file. You
should also tick the check box, as you will be using annotations for your mappings.
Search WWH ::




Custom Search