1. 程式人生 > >Hibernate的手動建表的方法【包含註解方式的手動見表】(二)

Hibernate的手動建表的方法【包含註解方式的手動見表】(二)

			//載入配置資訊
		Configuration cfg = new Configuration().configure();
		//例項化SchemaExport物件
		SchemaExport export = new SchemaExport(cfg);
		//匯出資料表
		export.create(true, true);

export.create(a,b)

第一個為True就是把DDL語句輸出到控制檯
第二個為True就是根據持久類和對映檔案先執行刪除再執行建立操作

new SchemaExport(new AnnotationConfiguration().configure()).create(false, true);