当前位置:Gxlcms > 数据库问题 > Hibernate控制台显示创建数据库表语句

Hibernate控制台显示创建数据库表语句

时间:2021-07-01 10:21:17 帮助过:21人阅读

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 }

 

Hibernate控制台显示创建数据库表语句

标签:sql   pre   建表   控制台   stat   form   span   imp   conf   

人气教程排行