import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;
public class SchemaUtil { public static void main(String[] args) { <span style="white-space:pre"> </span>Configuration cfg = new Configuration().configure();
SchemaExport schemaExport= new SchemaExport(cfg);
schemaExport.create(false, true); //schemaExport.create(false, true);第1个boolean类型是说是否覆盖原有的数据库,第2个boolean是说,是否新建数据库
}
}
本文介绍如何利用Hibernate的SchemaExport工具实现数据库的迁移与创建操作,包括是否覆盖原有数据库及新建数据库的选项。
261

被折叠的 条评论
为什么被折叠?



