| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1685 人关注过本帖
标题:hibernate 建表成功数据库中无此表
取消只看楼主 加入收藏
lzy85712
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2009-7-19
结帖率:0
收藏
已结贴  问题点数:20 回复次数:0 
hibernate 建表成功数据库中无此表
Fee的hbm.xml文件
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.

<hibernate-mapping>
    <class name="daomain.Fee" table="t_fee">
        <id name="id">
            <generator class="native"></generator>
        </id>
        <property name="feeid"/>
        <property name="feename"/>
        <property name="basefee"/>
        <property name="monthfee"/>
        <property name="describe"/>
    </class>
</hibernate-mapping>
hibernate.cfg.xml文件
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
          "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
          "http://hibernate.
<hibernate-configuration>
    <session-factory>
        <property name="connection.url">jdbc:mysql://localhost:3306/dianxing</property>
        <property name="dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="connection.username">root</property>
        <property name="connection.password">123456</property>
        <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="show_sql">true</property>
        <mapping resource="daomain/Fee.hbm.xml"/>
    </session-factory>
</hibernate-configuration>
package daomain;

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

public class ExportDB {
    public static void main(String[] args) {

        Configuration cfg = new Configuration().configure();
        
        SchemaExport export = new SchemaExport(cfg);
        
        export.create(true, true);
    }
}
最后是控制台输出的语句
log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment).
log4j:WARN Please initialize the log4j system properly.
drop table if exists t_fee
create table t_fee (id integer not null auto_increment, feeid varchar(255), feename varchar(255), basefee double precision, monthfee double precision, describe varchar(255), primary key (id))
但是去数据库中找无t_fee表 库中还有一张t_user表
搜索更多相关主题的帖子: 数据库 hibernate 
2009-07-19 09:33
快速回复:hibernate 建表成功数据库中无此表
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017348 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved