配置好hibernate的配置文件和映射文件以后可以通过SchemaExport工具导出sql脚本。

 

[java] view plaincopy
 
  1. import org.hibernate.cfg.Configuration;  
  2. import org.hibernate.tool.hbm2ddl.SchemaExport;  
  3.   
  4. public class ExportDB {  
  5.   
  6.     public static void main(String[] args) {  
  7.         Configuration cf=new Configuration().configure();  
  8.         SchemaExport sexport=new SchemaExport(cf);  
  9.         sexport.create(truetrue);  
  10.         System.out.println("导出成功");  
  11.     }  
  12.   
  13. }  

转载自http://blog.csdn.net/xiaoyu411502/article/details/5319232

posted on 2013-12-03 17:39  ymlove7  阅读(327)  评论(0)    收藏  举报