22:22:44,156 INFO Environment:500 - Hibernate 3.2.0
22:22:44,156 INFO Environment:533 - hibernate.properties not found
22:22:44,156 INFO Environment:667 - Bytecode provider name : cglib
22:22:44,156 INFO Environment:584 - using JDK 1.4 java.sql.Timestamp handling
22:22:44,203 INFO Configuration:1350 - configuring from resource: /hibernate.cfg.xml
22:22:44,203 INFO Configuration:1327 - Configuration resource: /hibernate.cfg.xml
22:22:44,375 DEBUG DTDEntityResolver:38 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd]
22:22:44,375 DEBUG DTDEntityResolver:40 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
22:22:44,375 DEBUG DTDEntityResolver:50 - located [http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd] in classpath
22:22:44,406 DEBUG Configuration:1311 - hibernate.connection.url=jdbc:mysql://localhost/hibernate_first
22:22:44,406 DEBUG Configuration:1311 - hibernate.connection.driver_class=com.mysql.jdbc.Driver
22:22:44,406 DEBUG Configuration:1311 - hibernate.connection.username=root
22:22:44,406 DEBUG Configuration:1311 - hibernate.connection.password=admin
22:22:44,421 DEBUG Configuration:1311 - hibernate.dialect=org.hibernate.dialect.MySQLDialect
22:22:44,421 DEBUG Configuration:1311 - hibernate.show_sql=true
22:22:44,421 DEBUG Configuration:1510 - null <-org.dom4j.tree.DefaultAttribute@19dfbff [Attribute: name resource value "com/hibernate/User.hbm.xml"]
22:22:44,421 INFO Configuration:507 - Reading mappings from resource: com/hibernate/User.hbm.xml
22:22:44,421 DEBUG DTDEntityResolver:38 - trying to resolve system-id [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd]
22:22:44,421 DEBUG DTDEntityResolver:40 - recognized hibernate namespace; attempting to resolve on classpath under org/hibernate/
22:22:44,421 DEBUG DTDEntityResolver:50 - located [http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd] in classpath
22:22:44,500 INFO HbmBinder:300 - Mapping class: com.hibernate.User -> User
22:22:44,500 DEBUG HbmBinder:1270 - Mapped property: id -> id
22:22:44,515 DEBUG HbmBinder:1270 - Mapped property: name -> name
22:22:44,515 DEBUG HbmBinder:1270 - Mapped property: password -> password
22:22:44,515 DEBUG HbmBinder:1270 - Mapped property: createTime -> createTime
22:22:44,515 DEBUG HbmBinder:1270 - Mapped property: expireTime -> expireTime
22:22:44,515 INFO Configuration:1465 - Configured SessionFactory: null
22:22:44,515 DEBUG Configuration:1466 - properties: {hibernate.connection.password=admin,
22:22:44,531 INFO Dialect:141 - Using dialect: org.hibernate.dialect.MySQLDialect
22:22:44,562 DEBUG Configuration:1044 - processing extends queue
22:22:44,578 DEBUG Configuration:1048 - processing collection mappings
22:22:44,578 DEBUG Configuration:1059 - processing native query and ResultSetMapping mappings
22:22:44,578 DEBUG Configuration:1067 - processing association property references
22:22:44,578 DEBUG Configuration:1089 - processing foreign key constraints
22:22:44,625 DEBUG Configuration:1044 - processing extends queue
22:22:44,625 DEBUG Configuration:1048 - processing collection mappings
22:22:44,625 DEBUG Configuration:1059 - processing native query and ResultSetMapping mappings
22:22:44,625 DEBUG Configuration:1067 - processing association property references
22:22:44,625 DEBUG Configuration:1089 - processing foreign key constraints
22:22:44,625 INFO SchemaExport:154 - Running hbm2ddl schema export
22:22:44,625 DEBUG SchemaExport:170 - import file not found: /import.sql
22:22:44,625 INFO SchemaExport:179 - exporting generated schema to database
22:22:44,625 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
22:22:44,625 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 20
22:22:44,625 INFO DriverManagerConnectionProvider:45 - autocommit mode: false
22:22:44,640 INFO DriverManagerConnectionProvider:80 - using driver: com.mysql.jdbc.Driver at URL: jdbc:mysql://localhost/hibernate_first
22:22:44,640 INFO DriverManagerConnectionProvider:83 - connection properties: {user=root, password=admin}
22:22:44,640 DEBUG DriverManagerConnectionProvider:93 - total checked-out connections: 0
22:22:44,640 DEBUG DriverManagerConnectionProvider:109 - opening new JDBC connection
22:22:44,843 DEBUG DriverManagerConnectionProvider:115 - created connection to: jdbc:mysql://localhost/hibernate_first, Isolation Level: 4
drop table if exists User
22:22:44,843 DEBUG SchemaExport:303 - drop table if exists User
22:22:44,875 DEBUG JDBCExceptionReporter:40 - SQL Warning
java.sql.SQLWarning: Unknown table 'user'
at com.mysql.jdbc.SQLError.convertShowWarningsToSQLWarnings(SQLError.java:722)
at com.mysql.jdbc.SQLError.convertShowWarningsToSQLWarnings(SQLError.java:650)
at com.mysql.jdbc.Statement.getWarnings(Statement.java:1657)
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:309)
at org.hibernate.tool.hbm2ddl.SchemaExport.drop(SchemaExport.java:284)
at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:186)
at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:133)
at com.hibernate.ExportDB.main(ExportDB.java:15)
22:22:44,875 WARN JDBCExceptionReporter:48 - SQL Warning: 1051, SQLState: 42S02
22:22:44,875 WARN JDBCExceptionReporter:49 - Unknown table 'user'
create table User (id varchar(255) not null, name varchar(255), password varchar(255), createTime datetime, expireTime datetime, primary key (id))
22:22:44,875 DEBUG SchemaExport:303 - create table User (id varchar(255) not null, name varchar(255), password varchar(255), createTime datetime, expireTime datetime, primary key (id))
22:22:44,875 ERROR SchemaExport:274 - Unsuccessful: create table User (id varchar(255) not null, name varchar(255), password varchar(255), createTime datetime, expireTime datetime, primary key (id))
22:22:44,875 ERROR SchemaExport:275 - The 'InnoDB' feature is disabled; you need MySQL built with 'InnoDB' to have it working
22:22:44,875 INFO SchemaExport:196 - schema export complete
22:22:44,875 DEBUG DriverManagerConnectionProvider:129 - returning connection to pool, pool size: 1
22:22:44,875 INFO DriverManagerConnectionProvider:147 - cleaning up connection pool: jdbc:mysql://localhost/hibernate_first
出现这样的错误时正常的情况,因为你在创建表的时候在数据库里面还没有你要创建的表,所以它开始创建表的时候它首先是从数据库里面去查找有没有你要创建的表,当有就删除,当没有找到就会报这样一个错误。
当你在第二次运行exportToDatabase中的这个文件的时候就不会出现上面的错误了。