Java Reference
In-Depth Information
Having created it initially, Hibernate allows you to export your user library configuration
so that it does not need to be created afresh on each machine that you work on, or when creat-
ing a new Eclipse workspace.
You should now create a new Java project called ToolsExample. The source code for the
example is available from the Apress web site ( www.apress.com ). Copy the files into the
ToolsExample folder in the workspace directory, and refresh the project.
n Tip If Eclipse is running under a 1.4 JVM or earlier, and you want to take advantage of annotations, you
must reconfigure it to run under Java 5. Add the -vm flag to the Eclipse command line to force the named JVM
to load Eclipse. For example, the shortcut to Eclipse on my Windows desktop contains the following target:
C:\eclipse\eclipse.exe -vm c:\home\jdk1.5.0_03\bin\javaw
At the time of writing, Hibernate Tools contains a minor bug that causes some prob-
lems if the configuration file is in the project root. We have therefore configured the project
to contain separate src and bin directories. You should configure the project to use these as
the source folder and default output folder, respectively. We expect this bug to be fixed by
the time you read this topic, but it is good practice to separate the directories in this way
anyway.
You now need to add the two user libraries to the project. Select the Build Path รค Config-
ure Build Path context menu option on the project. Select the Libraries tab on the resulting
dialog.
Click the Add Library button, and you will be presented with a list of library types. Select
the User Library option from the list, and click Next.
This will in turn present you with a list of the available user libraries. Check both of the
Hibernate libraries that you configured previously, and click Finish.
The libraries will be added to the list in the Libraries tab of the Java Build Path dialog; you
should click OK to accept the changes to the path. Figure B-6 shows the resulting uncluttered
project view.
Figure B-6. The configured Java project
So far in this section, we have configured a Java project in a conventional way. None of the
steps we have taken so far would be unusual in preparing to use a third-party library such as
the Spring Framework. The next few steps open a Hibernate Console perspective that will
allow you to manage the Hibernate-specific aspects of your project.
Search WWH ::




Custom Search