1 @Test
2 public void testCreateDB(){
3 Configuration cfg = new Configuration().configure();
4 SchemaExport se = new SchemaExport(cfg);
5 //第一个参数 是否生成ddl脚本 第二个参数 是否执行到数据库中
6 se.create(true, true);
7 }
使用Hibernate生成数据库
1 @Test
2 public void testCreateDB(){
3 Configuration cfg = new Configuration().configure();
4 SchemaExport se = new SchemaExport(cfg);
5 //第一个参数 是否生成ddl脚本 第二个参数 是否执行到数据库中
6 se.create(true, true);
7 }

被折叠的 条评论
为什么被折叠?