1 package cqvie.yjq.View;
 2 
 3 import org.hibernate.Session;
 4 import org.hibernate.Transaction;
 5 import org.hibernate.cfg.AnnotationConfiguration;
 6 import org.hibernate.tool.hbm2ddl.SchemaExport;
 7 
 8 public class Test {
 9 
10     public static void main(String[] args) {
11     
12         //调用建表语句
13         exportDDL();
14         
15     }
16 
17     //建表语句
18     public static void exportDDL() {  
19         Configuration configuration = new AnnotationConfiguration().configure();   
20         SchemaExport sexport = new SchemaExport(configuration);  
21         sexport.setFormat(true);//格式化输出  
22           sexport.setDelimiter(";");      //每句sql都以;结尾  不然导入sql的时候会出现错误  
23         sexport.setOutputFile("D:\\auto.sql");  
24         sexport.create(true, true);  
25     }  
26 }

 

相关文章:

  • 2021-11-21
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2021-11-23
  • 2021-12-19
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2021-10-27
相关资源
相似解决方案