Chapter 4. Starting from an Existing Schema

In many enterprise environments, applications will be based on an existing database schema, not the other way around. Hibernate, in conjunction with a tool called Middlegen, supports this development model. In this chapter, persistent objects will be derived from an existing MySQL schema, using Middlegen to generate the Hibernate mapping files; these will in turn be used to generate Java source files.

The example in this chapter should be familiar to anyone who has ever at tended school. The database schema models a set of courses and students, tracking exams and exam results for each student. Many books on relational database design include this example—especially some of the more academic texts.

Initial ...

Get Hibernate: A J2EE™ Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.