Hibernate根据实体生成数据库表
来源:互联网 发布:centos 6.5 php7 编辑:程序博客网 时间:2024/05/01 15:46
package org.xia.utils;
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;
/**
* 根据hibernate.cfg.xml配置文件和相应实体类及其.hbm.xml文件生成对应的数据库表
* 步骤:
* 1.建立hibernate.cfg.xml配置文件且在数据库url后面指定数据库名称jdbc:mysql://localhost:3306/DB_NAME(该配置文件放在src根目录)
* 2.建立好相应的POJO类和对应的.hbm.xml文件(需要hibernate.cfg.xml中配置)
* 3.创建数据库DB_NAME;
* 4.打开数据库DB_NAME;
* 5.执行此类
* @author Administrator
*
*/
public class ExportDB {
public static void main(String[] args) {
//读取hibernate.cfg.xml文件
Configuration cfg = new Configuration().configure();
SchemaExport export = new SchemaExport(cfg);
export.create(true, true);
}
}
- Hibernate根据实体生成数据库表
- 如何根据hibernate的实体类和实体类配置文件生成数据库的表
- 如何根据hibernate的实体类和实体类配置文件生成数据库的表
- hibernate 根据实体类自动生成表
- hibernate 根据实体类自动生成表
- 根据Hibernate映射文件和实体类生成数据库
- Java根据数据库表生成实体
- Intelij根据数据库表生成实体类
- mybatis 根据 数据库表 自动生成 实体
- 根据Hibernate 实体类配置的xml 生成数据库表代码
- Hibernate 根据实体映射文件自动生成表
- oracle存储过程 根据表名生成hibernate实体
- hibernate根据实体自动生成表的设置
- hibernate根据JPA生成实体类笔记
- hibernate 根据对象关系表生成 数据库
- hibernate根据配置文件生成数据库表
- hibernate 根据配置文件自动生成数据库表
- 用Java根据数据库表生成实体类
- 黑马程序员——JAVA学习日志6
- sql索引
- 图像处理算法系列 第四章 直方图
- 期货交易常用术语英语词汇
- linux下的打包--压缩--解压 总结
- Hibernate根据实体生成数据库表
- zoj-1037
- Word Ladder
- hive的3种数据存储格式
- Android系统工具之Monkey自动化测试
- mybatis的foreach简单使用
- 虚拟机VMware越用体积越大问题的解决方法
- zookeeper研究笔记(二)—— 集群模式搭建
- SeaJS