使用Hiernbate創建表格

測試Hierbnate之前,需要建立表格

package com.houlu.SH_DRP.util;

import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;

/**
 * 將hbm導出生成ddl
 * @author Administrator
 *
 */
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);
    }

}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章