You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Ryan Christianson <ry...@echospace.com> on 2003/08/13 18:30:45 UTC

hypersonic primarykey's

I had some problems with primary keys with hypersonic. I fixed my issue, 
and I thought I would share. Maybe it will help someone else, or maybe 
I'm crazy.

In my schema xml file I have this:

        <column
            name="portal_setting_id"
            required="true"
            primaryKey="true"
            type="INTEGER"
            autoIncrement="true"
        />

Note, that I had to stick the autoIncrement="true" line in there, or 
else hypersonic did'nt reconize that this column was the primary key, 
and would give errors about passing NULL for a non null column.

Now, with the autoIncrement="true" and  primaryKey="true" then torque 
was generating the init tables sql code like this (for hypersonic):

CREATE TABLE portal_setting
(
    portal_setting_id integer IDENTITY,
    default_skin_id integer
    PRIMARY KEY( portal_setting_id ),
);

Hypersonic however didnt like that. When I would create the database in 
hypersonic, it would say that I was creating a second primary key. So I 
changed the template for outputing primary keys for hypersonic to this:

#if ($table.hasPrimaryKey())   
##    PRIMARY KEY($table.printPrimaryKey()),
#end

It all works fine. In fact, if I peek in the hypersonic database script 
file it shows that it is a primary key:

CREATE TABLE PORTAL_SETTING(PORTAL_SETTING_ID INTEGER NOT NULL IDENTITY 
PRIMARY KEY,DEFAULT_SKIN_ID INTEGER)

Maybe the templates for hypersonic should be updated?

Hope this helps someone.

Ryan Christianson





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