Hello.
I am using Torque with OJB and came across a bug when generating a SQL
script for HSQL. If the schema xml file has a column tag with both
primaryKey and autoIncrement attributes, it generates incorrect HSQL create
table syntax. The latest version (and probably other versions) of HSQL does
not appear to allow having a column specified as "IDENTITY" and setting that
same column as "PRIMARY KEY". According to the HSQL documentation, identity
columns are "automatically primary key columns."
NOT CORRECT:
CREATE TABLE Product
(
id integer IDENTITY,
name VARCHAR (30),
price DOUBLE,
stock integer,
PRIMARY KEY(id)
);
CORRECT:
CREATE TABLE Product
(
id integer IDENTITY,
name VARCHAR (30),
price DOUBLE,
stock integer
);
I modified the primarykey.vm to work when both of these attributes are
specified:
/sql/base/hypersonic/primarykey.vm
----------------------------------------------------------------------------
-------
#if ($table.hasPrimaryKey())
#set ( $hasAutoIncrement = "false" )
#foreach ($col in $table.Columns)
#if ( $col.isAutoIncrement() )
#set ( $hasAutoIncrement = "true" )
#end
#end
#if ( $hasAutoIncrement == "false" )
PRIMARY KEY($table.printPrimaryKey()),
#end
#end
-mike
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]