Java Reference
In-Depth Information
<path id="classpath.base">
<pathelement location="${hibernate.path}"/>
<fileset dir="${hibernate.lib}" includes="**/*.jar"/>
<pathelement location="${hibernate.annotations.path}"/>
<fileset dir="${hibernate.annotations.lib}" includes="**/*.jar"/>
</path>
<path id="classpath.tools">
<path refid="classpath.base"/>
<pathelement location="${hibernate.tools.path}"/>
<pathelement location="${jdbc.driver.path}"/>
</path>
The task definition (as shown earlier in this section) would use the classpath with the ID
classpath.tools .
The tasks themselves will need access to two additional sets of resources: the configura-
tion file(s) and the compiled classes.
<path id="classpath.apps">
<path refid="classpath.base"/>
<pathelement path="${src}"/>
<pathelement path="${bin}"/>
<pathelement location="${jdbc.driver.path}"/>
</path>
The configuration files will include the hibernate.cfg.xml and/or hibernate.properties
files, along with any log4j configuration files, cache configuration files, and applicable XML
mapping files.
If you are using annotations in any of your tasks, you will need to ensure that the task is
assigned a dependency upon the compiled POJOs—annotations cannot be read at run time
from Java source files, only from compiled classes.
Summary
In this appendix, we have discussed the installation and use of Hibernate Tools, including the
Eclipse plug-in and the Ant tasks. Together, these remove most of the need to manually create
boilerplate configuration code.
In Appendix C, we discuss how Hibernate can be used as the data access layer within the
Spring Framework.
Search WWH ::




Custom Search