O'Reilly logo

Harnessing Hibernate by James Elliott, Ryan Fowler, Timothy M. O'Brien

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

More Editing Support

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.

Autocompletion of column names in the Hibernate mapping editor

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 class 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 drop-down menu.

Warning

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required