db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andras Salamon <asala...@hu.inter.net>
Subject Re: HyperSonic and primaryKey
Date Tue, 09 Mar 2004 19:20:38 GMT
On Mon, 8 Mar 2004, [iso-8859-1] Guillaume Barré wrote:

Hi,

> HI
> 
>  
> 
> A sql problem with hypersonic.
> 
>  
> 
> My schema file looks like : 
> 
>  
> 
> <table javaName="CourseSupplier" name="CMS_COURSE_SUPPLIERS" idMethod="native">
> 
> <column javaName="Id" name="ID" primaryKey="true" required="true"  autoIncrement="true"
 type="INTEGER"/>
> 
>             <column javaName="ContactFirtName" name="CONTACT_FIRST_NAME" size="50"
type="VARCHAR"  />
> 
>             <column javaName="ContactLastName" name="CONTACT_LAST_NAME" size="50"
type="VARCHAR" />
> 
>             <column javaName="ContactEmail" name="CONTACT_EMAIL" size="50" type="VARCHAR"
/>
> 
> </table>
> 
>  
> 
> And the gemerated SQL code is : 
> 
>  
> 
> CREATE TABLE TEST_COURSE_SUPPLIERS
> (
>     ID integer IDENTITY,
>     CONTACT_FIRST_NAME VARCHAR (50),
>     CONTACT_LAST_NAME VARCHAR (50),
>     CONTACT_EMAIL VARCHAR (50),
>     PRIMARY KEY(ID)
> );
> 
>  
> 
>  
> 
> My problem is that when I create the table on HyperSonic I have the
> following error
> 
>  
> 
> Erreur Attempt to define a second primary key in statement ... Error
> code 24 / State S0011
> 
>  
> 
> Any idea ?
>

IDENTITY type will create an automatic primary key, so there is 2 primary 
keys on ID column.

Turn off something (autoincrement or primary key). Since I always use 
autoincrement on my primary keys, I changed the template 
(hypersonic/primarykey.vm):

#if ($table.hasPrimaryKey() && ($table.IdMethod != "native"))    
    PRIMARY KEY($table.printPrimaryKey()),
#end

So it will not create primary key if the idMethod is native.

Hope this helps,

Sala
 
>  
> 
> Thanks in advance
> 
> Guillaume
> 
>  
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Mime
View raw message