Java Reference
In-Depth Information
This exporter can be used to permit the mapping file-based creation of suitable classes,
or to create classes from the database schema when <jdbcconfiguration> is used.
The <hbm2hbmxml> element generates the XML mapping files from the information con-
tained in the metamodel. Table B-6 shows the attributes that can be supplied.
Table B-6. The Attributes Available to the <hbm2hbmxml> Element
Property
Default
Description
destdir
If set, overrides, for this exporter only, the destination directory specified
on the tools task
This exporter is particularly terse because it only writes out the mapping information
stored in the metamodel. This is all handled by the appropriate configuration element. The
<hbm2hbmxml> exporter just needs to know which path to write the XML files into. And that can
be specified at the Hibernate tool level. A fairly typical invocation of this exporter is, in its
entirety, the ridiculously simple <hbm2hbmxml/> .
The <hbm2doc> element generates HTML documentation of the schema and entities in
a style similar to the familiar javadoc output. Table B-7 shows the attributes that can be
supplied.
Table B-7. The Attributes Available to the <hbm2doc> Exporter Element
Property
Default
Description
destdir
If set, overrides, for this exporter only, the destination directory specified
on the tools task
The <hbm2dao> element generates a set of basic DAO classes—one for each of the entities
in the metadata. Table B-8 shows the attributes that can be supplied.
Table B-8. The Attributes Available to the <hbm2dao> Exporter Element
Property
Default
Description
destdir
If set, overrides, for this exporter only, the destination directory specified
on the tools task
By default, these DAO classes will be named after your entity, suffixed with Home . The gen-
erated DAOs provide a set of methods roughly corresponding to the methods available on the
Session interface, but strongly tied to the entity type. While the generated DAOs can provide a
useful foundation for your own more specific DAOs, we generally find that they offer little
value beyond that already offered from the standard Session interactions.
n Note Nothing in any of the exporters intrinsically stops you from generating “silly” combinations of output—
but this has its advantages; for example, it is possible to use an <annotationsconfiguration> configuration
element with the <hbm2java> exporter to generate POJOs. While that might seem pointless, given that you have
to start with POJOs to use an annotations-based configuration in the first place, it actually provides the useful
ability to generate Java 1.4-compatible source code from annotated Java 5 class files!
Search WWH ::




Custom Search