首页 > Web开发 > 详细

hibernate代码生成pojo对应的表

时间:2018-08-29 17:46:41      阅读:186      评论:0      收藏:0      [点我收藏+]

1、创建一个Java工程然后进行hibernate的环境搭配

2、在创建一个com.test包,在包中创建一个类

package test;

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

public class CreateTable {
    public static void main(String[] args) {
        Configuration configuration = new Configuration().configure();
        SchemaExport export = new SchemaExport(configuration);
        export.create(true, true);
    }
}

3、在数据库中创建一个与在总配置文件设置好的数据库名相同名字的数据库

4、然后运行程序就会在数据库中创建对应的表

hibernate代码生成pojo对应的表

原文:https://www.cnblogs.com/myfaith-feng/p/9555601.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!