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.

Generating the database scripts from mappings

In the beginning, we looked at one use of the SchemaExport class where we used it to generate database creation scripts based on mappings declared. In this section, we would delve deeper into this to see what different options SchemaExport offers to generate database creation scripts. We are also going to look at another class named SchemaUpdate that can generate database update scripts by comparing changed mappings and existing database schema.

Note

If you are working on a legacy project with an existing database then you would have little use of the SchemaExport class. Since you have already got a database in place, there is no need to generate a new database creation script. You may want to use

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