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
Get Learning NHibernate 4 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.