Now that we’ve got the Hibernate Tools enabled for our project, what kinds of things can we do? Well, now, when you’re editing a mapping file, the XML editor gains the ability to auto-complete table and column names for you (Figure 11-18). This explains why a project needs to be associated with a Hibernate Console configuration: the Hibernate Tools actually maintain a Hibernate session which can be used to inspect the database schema, and provide relevant assistance based on the actual project environment.
Figure 11-18. Autocompletion of column names in the Hibernate mapping editor
We’ve shown completion of column names in the
TRACK table here, but you can complete table
names as well (up in the
definition as well as in association definitions). Also, assuming you’ve
already created the Java objects that will form your model, completion
help is available for property names and class names, with JavaDoc support
(as in Figure 11-19). Completion for property types is also always available,
although that’s even easier to pick in the nonsource view, where it is a
We did run into one “gotcha” in playing with
database-driven completion. Even though SQL is usually case-insensitive
when it comes to matching table and column names, the Hibernate Tools
are not, and we couldn’t get completion to work properly until we
noticed that our
track table ...