hibernate之HSQLDB(2)---hbm2ddl生成schema时出错
build.xml文件就不说了,
Track.hbm.xml:
--------------------------------------------------------------------------------------------
<hibernate-mapping>
<class name="com.oreilly.hh.Track" table="TRACK">
<meta attribute="class-description">
Represents a single playable track in the music database.
@author Jim Elliott (with help from Hibernate)
</meta>
<id name="id" type="int" column="TRACK_ID">
<meta attribute="scope-set">protected</meta>
<generator class="native"/>
</id>
<property name="title" type="string" not-null="true"/>
<property name="filePath" type="string" not-null="true"/>
<property name="playTime" type="time">
<meta attribute="field-description">Playing time</meta>
</property>
<property name="added" type="date">
<meta attribute="field-description">When the track was created</meta>
</property>
<property name="volume" type="short">
<meta attribute="field-description">How loud to play the track</meta>
</property>
</class>
</hibernate-mapping>
错误提示信息:
[schemaexport] drop table TRACK if exists
[schemaexport] 17:44:36,848 DEBUG SchemaExport:132 - drop table TRACK if exists
[schemaexport] 17:44:36,908 DEBUG SchemaExport:149 - create table TRACK (
[schemaexport] TRACK_ID integer generated by default as identity (start with1),
[schemaexport] title varchar(255) not null,
[schemaexport] filePath varchar(255) not null,
[schemaexport] playTime time,
[schemaexport] added date,
[schemaexport] volume smallint
[schemaexport] )
[schemaexport] 17:44:36,928 ERROR SchemaExport:154 - Unsuccessful: create table
TRACK (TRACK_ID integer generated by default as identity (start with 1), title v
archar(255) not null, filePath varchar(255) not null, playTime time, added date,
volume smallint)
[schemaexport] 17:44:36,928 ERROR SchemaExport:155 - Unexpected token: GENERATED
in statement [create table TRACK (TRACK_ID integer generated by default as iden
tity (start with 1), title varchar(255) not null, filePath varchar(255) not null
, playTime time, added date, volume smallint)]
调试了很多次, 都是如此. 后来我换了HSQLDB的驱动包, 就ok了.
浙公网安备 33010602011771号