利用Hibernate对象配置信息自动导出生成表结构

来源:互联网 发布:美版mac如何新建文件夹 编辑:程序博客网 时间:2024/05/21 19:36

package cn.com.justin.hibernate;

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

/**
 * 执行导出操作,hibernate将根据实体映射信息自动生成表结构
 * @author Justin Hu
 *
 */
public class ExportDbUsingHibernate {
 public static void main(String[] args) {  
        Configuration configuration=new Configuration().configure();  
        SchemaExport schemaExport=new SchemaExport(configuration);  
        schemaExport.create(true, true);
        System.out.println("***************导出操作已经成功执行完毕******************");
    }  

}

原创粉丝点击