java hibernate SchemaExport 创建数据表

来源:互联网 发布:淘宝衣服款式怎么设置 编辑:程序博客网 时间:2024/05/16 05:42
import org.hibernate.cfg.Configuration; import org.hibernate.tool.hbm2ddl.SchemaExport;public class SchemaUtil {    
     public static void main(String[] args) {        
<span style="white-space:pre"></span>Configuration cfg = new Configuration().configure();        SchemaExport schemaExport= new SchemaExport(cfg);        schemaExport.create(false, true);  //schemaExport.create(false, true);第1个boolean类型是说是否覆盖原有的数据库,第2个boolean是说,是否新建数据库    }}

0 0
原创粉丝点击