package cqvie.yjq.View;

 import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.cfg.AnnotationConfiguration;
import org.hibernate.tool.hbm2ddl.SchemaExport; public class Test { public static void main(String[] args) { //调用建表语句
exportDDL(); } //建表语句
public static void exportDDL() {
Configuration configuration = new AnnotationConfiguration().configure();
SchemaExport sexport = new SchemaExport(configuration);
sexport.setFormat(true);//格式化输出
sexport.setDelimiter(";"); //每句sql都以;结尾 不然导入sql的时候会出现错误
sexport.setOutputFile("D:\\auto.sql");
sexport.create(true, true);
}
}
05-07 15:26