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表