package com.bjpowernode.hibernate;import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;/*** 将hbm生成ddl* @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);}
}
drop table if exists Userdrop table if exists User2create table User (id varchar(255) not null,name varchar(255),password varchar(255),createTime datetime,expireTime datetime,primary key (id))create table User2 (id varchar(255) not null auto_increment,name varchar(255),password varchar(255),createTime datetime,expireTime datetime,primary key (id))