286 APPENDIX B n HIBERNATE TOOLS APPENDIX B (Affordable web design)

286 APPENDIX B n HIBERNATE TOOLS APPENDIX B n HIBERNATE TOOLS Table B-1. The Daughter Elements of the Hibernate Tools Task Attribute Description classpath The path to use when locating libraries and configuration files. destDir The base directory (relative to the build script s own base directory) into which any generated output will be written. templatePath The path containing user-created template files (see the further discussion of templates in the Templates section later in the chapter.) Within the declared Hibernate task, a number of additional standard elements can be created, consisting of a classpath declaration (an alternative to using the classpath attribute), a set of configuration elements, and a set of exporter elements. The classpath element and attribute are standard Ant features that allow you to bring in any necessary resources used by the Hibernate tasks. The clever bit of the Hibernate Ant task lies in the configuration elements. Declaring a configuration task causes an appropriate configuration object to be built in memory. These in-memory configuration objects all extend the standard org.hibernate.cfg.Configuration class. The Configuration class represents the mapping relationships between entities (combined with information from any configuration, properties, or reverse engineering files), and it is this information, the metamodel, that is then used to generate the various output files. The provided configuration elements can conjure up a Configuration object from the standard mapping files, from the metadata information gathered over a JDBC connection, and from the annotations discussed in Chapter 6. Within any given Hibernate Tools task, you can only have one configuration element configured normally, you would not want to generate output from two distinct representations of the mapping information, so the single declaration is shared between the generation tasks enclosed within the toolset task elements. The following list describes the configuration tasks and the attributes of each: : Mapping relationships are generated from conventional XML-based mapping files and information in a *.cfg.xmlor *.properties file. configurationfile: The name of the XML configuration file being used. propertyfile: The name of the properties file being used. entityresolver: The name of the SAX EntityResolver to use when resolving external XML entities (rarely used). namingstrategy: A naming strategy to use (see Chapter 3) to establish table names from entity names.
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

Leave a Reply