ITeye博客

hibernate从POJO创建数据库表

wyyl00 · 2010-07-19 23:52 · ssh学习 · 企业架构 · Markdown

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文件。

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。