Configuration config = new Configuration().configure();
SchemaExport se = new SchemaExport(config);
se.setOutputFile("E:\\sql.txt");//保存建表语句
se.create(true, false);//第一个参数为是否显示建表语句,第二个为是否在创建表之前删除同名表
当然,得先配置好hibernate.cfg.xml以及相应的POJO和**.hbm..xml文件。