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