根据Hibernte的cfg文件生成sql文件
清醒时做事,糊涂时读书,大怒时睡觉,无聊时关注图老师为大家准备的精彩内容。下面为大家推荐根据Hibernte的cfg文件生成sql文件,无聊中的都看过来。
public void exportHibernteToSQL(){
Configuration cfg=new Configuration().configure("/hibernate.cfg.xml");
SchemaExport schemaExport = new SchemaExport(cfg);
schemaExport.setOutputFile("d:/mysql_sql.sql");
schemaExport.create(true, false);
}
注意:Hibernate的配置文件是什么数据库方言和驱动,将生成什么数据库脚本。


