`

hbm2ddl工具类,将实体类生成数据库表

阅读更多
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;

public class ExportDB {

	/**
	 * @param args
	 * 将hibernate实体类映射成数据库表
	 */
	public static void main(String[] args) {

       //默认读取 hibernate.properties 文件
	   //Configuration config = new Configuration();

		//读取 hibernate.cfg.xml 文件
		Configuration config = new Configuration().configure();
		
		SchemaExport export = new SchemaExport(config);
		
		export.create(true, true);

	}

}
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics