两种方法:
一种是hibernate.cfg.xml设置下:<property name="hbm2ddl.auto">create</property>
一种是用代码写法:
public class ExportDB {
public static void main(String[] args) {
//读取hibernate.cfg.xml文件
Configuration cfg = new Configuration().configure();
SchemaExport export = new SchemaExport(cfg);
export.create(true, true);
}
}
一种是hibernate.cfg.xml设置下:<property name="hbm2ddl.auto">create</property>
一种是用代码写法:
public class ExportDB {
public static void main(String[] args) {
//读取hibernate.cfg.xml文件
Configuration cfg = new Configuration().configure();
SchemaExport export = new SchemaExport(cfg);
export.create(true, true);
}
}