Hibernate根据映射文件生成数据库表

package com.xy.HibernateUtil;

import org.hibernate.cfg.Configuration;

import java.io.File;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;

public class ExportDB {

static Session session; 

static Configuration config = null; 
static Transaction tx = null; 

public static void main(String[] args) { 
    /** *//** *//** *//** 
    * 根据映射文件创建数据库结构 
    */ 
    try{ 
        config = new Configuration().configure(new File( 
                "src/hibernate.cfg.xml")); 

        System.out.println("Creating tables..."); 

        SessionFactory sessionFactory = config.buildSessionFactory(); 
        session = sessionFactory.openSession(); 
        tx = session.beginTransaction(); 

        SchemaExport schemaExport = new SchemaExport(config); 
        schemaExport.create(true, true); 

        System.out.println("Table created."); 

        tx.commit(); 

    } catch (HibernateException e) { 
        e.printStackTrace(); 
        try{ 
            tx.rollback(); 
        } catch (HibernateException e1) { 
            e1.printStackTrace(); 
        } 
    } finally { 
        session.close(); 
    } 
} 

}
通过这个类生成数据库的表,为什么明明显示执行了两条CREATE语句,生成了两个表,但是在数据库中只生成了一个表啊?
Creating tables...
alter table t_order drop foreign key FKA0C0C3C3734A7296
drop table if exists t_customer
drop table if exists t_order
create table t_customer (id integer not null auto_increment, name varchar(255), age integer, primary key (id))
create table t_order (id integer not null auto_increment, name varchar(255), desc varchar(255), tim datetime, customer_id integer, primary key (id))
alter table t_order add index FKA0C0C3C3734A7296 (customer_id), add constraint FKA0C0C3C3734A7296 foreign key (customer_id) references t_customer (id)
Table created.
这个是生成的SQL语句

首先我鄙视你一下,哈哈…………

你把
create table t_order (id integer not null auto_increment, name varchar(255), desc varchar(255), tim datetime, customer_id integer, primary key (id))

这个拿到mysql运行不就得了,结果报错!

什么原因呢??
desc varchar(255)中的desc是关键字,换个名字就可以了!

这个不是hibernate的原因,完全是数据库的问题!!
ok , 换个名字吧!!

你用的是单例模式?