 |
|
我的hibernate.propertis如下: hibernate.dialect=org.hibernate.dialect.SQLServerDialect hibernate.connection.driver_class=com.microsoft.jdbc.sqlserver.SQLServerDriver hibernate.connection.url=jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=abc hibernate.connection.username=sa hibernate.connection.password=sa hibernate.show_sql=true builetable.xml如下: <?xml version="1.0" encoding="UTF-8"?> <project name="abc" default="createDatabase" basedir="."> <property file="${src.dir}/hibernate.properties" /> <path id="project.class.path"> <fileset dir="${lib.dir}" includes="*.jar" /> </path> <target name="createDatabase"> <echo> +---------------------------------------------------+ </echo> <echo> | | </echo> <echo> | C R E A T I N G D A T A B A S E | </echo> <echo> | | </echo> <echo> +---------------------------------------------------+ </echo> <taskdef name="schemaexport" classname="org.hibernate.tool.hbm2ddl.SchemaExportTask"> <classpath> <fileset dir="WebContent/WEB-INF/lib/"> <include name="*.jar" /> </fileset> <pathelement location="build/classes" /> </classpath> </taskdef> <schemaexport properties="hibernate.properties" quiet="no" text="no" drop="no" delimiter=";" output="database.sql"> <fileset dir="src\org\ial\model"> <include name="*.hbm.xml" /> </fileset> </schemaexport> </target> </project> 我想用这两个配置文件,加上相应的*.hbm.xml在mssql生成表。总是出现错误: (connection.DriverManagerConnectionProvider 41 ) Using Hibernate built-in connection pool (not for production use!) [schemaexport] (connection.DriverManagerConnectionProvider 42 ) Hibernate connection pool size: 20 [schemaexport] (connection.DriverManagerConnectionProvider 45 ) autocommit mode: false [schemaexport] (connection.DriverManagerConnectionProvider 80 ) using driver: com.microsoft.jdbc.sqlserver.SQLServerDriver at URL: jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=abc [schemaexport] (connection.DriverManagerConnectionProvider 86 ) connection properties: {user=sa, password=****, pool.size=80} [schemaexport] drop table USER; [schemaexport] create table USER (USERID varchar(8) identity not null, COUNTRY varchar(3) null, EMAIL varchar(40) not null, FIRST_NAME varchar(40) not null, LAST_NAME varchar(40) not null, PHONE_NUMBER varchar(15) not null, REMARKS varchar(200) not null, SEX varchar(1) null, STATUS_LOGON varchar(1) null, TITLE varchar(4) null, AMEND_DATE datetime null, AMEND_USER varchar(50) null, CREATE_DATE datetime not null, CREATE_USER varchar(50) not null, primary key (USERID)); [schemaexport] (hbm2ddl.SchemaExport 274 ) Unsuccessful: create table USER (USERID varchar(8) identity not null, COUNTRY varchar(3) null, EMAIL varchar(40) not null, FIRST_NAME varchar(40) not null, LAST_NAME varchar(40) not null, PHONE_NUMBER varchar(15) not null, REMARKS varchar(200) not null, SEX varchar(1) null, STATUS_LOGON varchar(1) null, TITLE varchar(4) null, AMEND_DATE datetime null, AMEND_USER varchar(50) null, CREATE_DATE datetime not null, CREATE_USER varchar(50) not null, primary key (USERID)) [schemaexport] (hbm2ddl.SchemaExport 275 ) [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]在关键字 'USER' 附近有语法错误。 [schemaexport] (hbm2ddl.SchemaExport 196 ) schema export complete [schemaexport] (util.JDBCExceptionReporter 48 ) SQL Warning: 0, SQLState: [schemaexport] (util.JDBCExceptionReporter 49 ) [Microsoft][SQLServer 2000 Driver for JDBC]Database changed to achievo [schemaexport] (util.JDBCExceptionReporter 48 ) SQL Warning: 5701, SQLState: 01000 [schemaexport] (util.JDBCExceptionReporter 49 ) [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]已将数据库上下文改为 'achievo'。 [schemaexport] (util.JDBCExceptionReporter 48 ) SQL Warning: 0, SQLState: [schemaexport] (util.JDBCExceptionReporter &nbs[1] [2] 下一页
|
|
|
|
|
|