当配置好相关的文件,测试通过后,我们对数据库进行表的操作后,可以通过下面的代码在后台输出数据库脚本文件。
public class ExportDB {
public static void main(String[] args) {
// 读取hibernate.cfg.xml文件
Configuration cfg = new Configuration().configure();
SchemaExport export = new SchemaExport(cfg);
export.create(true, true);
}
}