Java Reference
In-Depth Information
The only missing output is the database schema. The reverse engineering file can be gen-
erated from the database as we have described here, but it can also be created manually. We
have already shown that it is possible to use the Hibernate Console's SchemaExport function
to export an annotated POJO or mapping file into a database schema. So, using this function-
ality, it is possible to create pretty much everything from scratch, starting from a mapping, a
database, or a set of POJOs.
When you create your code generation configuration, you need to specify the location of
your reverse engineering file, and the console configuration that will be used to establish the
appropriate connection details. You need to specify the output directory into which the gener-
ated files should be written, and you can also specify a package that any generated classes
should belong to.
You will then need to select the types of output to be generated, as shown in Figure B-25.
Figure B-25. Selecting the types of output to be generated
In Figure B-25, we have selected everything except the Hibernate configuration file
(we've already got one), the JBoss Seam application (we're not interested in that), and—
because of a minor bug—the EJB 3 annotations option. You would not normally elect to
generate both annotations and XML mapping files anyway.
n Note At the time of writing, the EJB3/JSR-220 annotations exporter option does not work. If this problem
has not been fixed by the time you read this topic, you can use an Ant task instead.
The Ant Tasks
As you will have noticed if you followed through the Eclipse discussion, our example project
for this appendix includes build.xml and build.properties files. These are not strictly neces-
sary when working with Eclipse, but it is often desirable to be able to build all the components
Search WWH ::




Custom Search