Java Reference
In-Depth Information
In Figure B-23, we have selected all the tables anyway. Once you click Finish, the reverse
engineering file will be generated, and an editor will be opened for it. This is a tabbed view of
the XML file (the last tab shows the XML source code). This allows you to change the default
mappings between the database and Hibernate types, to alter the table and column details,
and to apply additional filters to the file itself that dictate which details will be ignored when
generating output from the reverse engineering file.
We would not recommend trying to get to grips too closely with the reverse engineer-
ing tool until you have some experience in creating mappings manually—the various
settings will seem quite opaque when taken out of context. Once you have created a few
simple entity models from scratch, however, the need for the various options should
become clearer.
In order to actually generate output from the tool, you will need to create a Hibernate
code generation configuration by selecting the option in the toolbar of either perspective, as
shown in Figure B-24.
Figure B-24. Selecting the Hibernate Code Generation configuration tool
n Note At the time of writing, the Hibernate Code Generation icon does not seem to be added to the Eclipse
toolbar when you install the plug-in. This will probably be fixed by the time you read this topic, but if not, you
may have to use the JBoss IDE download or an Ant task if you want to take advantage of these features.
The Code Generation tool allows you to create various different configurations for gener-
ating files based upon your reverse engineering XML file(s). The tool can output the following:
Ordinary POJOs
POJOs using generics
POJOs using EJB 3 annotations (with or without generics)
DAO objects
XML mapping files
Hibernate configuration files
HTML documentation of the database schema
It also permits you to create a JBoss Seam skeleton application, but this functionality lies
well outside the scope of this topic.
Search WWH ::




Custom Search