配置好hibernate的配置文件和映射文件以后可以通过SchemaExport工具导出sql脚本。
- import org.hibernate.cfg.Configuration;
- import org.hibernate.tool.hbm2ddl.SchemaExport;
- public class ExportDB {
- public static void main(String[] args) {
- Configuration cf=new Configuration().configure();
- SchemaExport sexport=new SchemaExport(cf);
- sexport.create(true, true);
- System.out.println("导出成功");
- }
- }
转载自http://blog.csdn.net/xiaoyu411502/article/details/5319232
浙公网安备 33010602011771号