Java Reference
In-Depth Information
<annotationconfiguration> : Mapping relationships are generated from the EJB 3 and
Hibernate 3 annotations in conjunction with a *.cfg.xml or *.properties file.
Identical to <configuration> .
<jdbcconfiguration> : Mapping relationships are generated from the schema metadata
obtained over a JDBC connection. The connection details are configured from a prop-
erties file.
All those from <configuration> , plus the following:
packagename : The name of the package that entities should belong to.
reversestrategy : The fully qualified name of a class implementing the org.
hibernate.cfg.reveng.ReverseEngineeringStrategy interface. This is the pro-
grammatic equivalent of the reveng.xml file approach.
revengfile : The name of a reverse engineering file to use when processing meta-
data information. See the discussion later in this section.
<ejb3configuration> : Mapping relationships are generated from the EJB 3 and Hiber-
nate 3 annotations in conjunction with an EJB 3-compliant persistence.xml file.
entityresolver : The name of the SAX EntityResolver to use when resolving “exter-
nal” XML entities.
namingstrategy : A naming strategy to use (see Chapter 3) to establish table names
from entity names.
The <configuration> element also allows you to specify a standard Ant <fileset> of
*.hbm.xml mapping files. If you use this in conjunction with a *.cfg.xml configuration file,
you must not permit any mapping resources to be duplicated, as this will result in duplicate
import mapping exceptions.
Your choice of configuration element will be driven by the data sources that you have
available to you. For example, if you have created your XML mapping files, you will want to
use the standard configuration element, but if you have only a normalized database, you will
want to generate the mapping information from this using the JDBC configuration (although
you may well choose to create a reverse engineering file to control this).
Once you have correctly configured an annotation object, however, you can generate any
of the other resources that you might need using one or more exporter elements. These are
listed in Table B-2.
Table B-2. The Available Exporter Elements
Element
Description
<hbm2ddl>
Generates tables from the metamodel
<hbm2cfgxml>
Generates a *.cfg.xml configuration file from the metamodel
<hbm2java>
Generates entity POJOs from the metamodel
<hbm2hbmxml>
Generates Hibernate *.hbm.xml mapping files from the metamodel
Continued
Search WWH ::




Custom Search