Hi Will,

I agree the defaultMethodId/autoIncrement stuff is a bit weird. Thanks
for your comments, I'll try and get through them and see if things can
be approved this weekend.

Just to make sure I understand what you're saying, that if
defaultIdMethod="native", then autoIncrement should be assumed? As I
think if you added autoIncrement="true" to your primary key columns,
you'd get the correct SQL output.

- Stephen

> -----Original Message-----
> From: Will Holcomb [mailto:[EMAIL PROTECTED]]
> Sent: Friday, July 26, 2002 12:49 PM
> To: Turbine Torque Users List
> Subject: generating id's on primary keys
> 
> In the torque tutorial it says...
> 
> "Another item of importance is the database element's defaultIdMethod
>  attribute. This attribute specifies the default method that Torque
will
>  use to generate IDs for primary keys (columns with the primaryKey
>  attribute set to true: book_id, publisher_id, and author_id) in your
>  database tables. There are several possible values..."
> 
> I have a database like this:
> 
> <database name="directory" defaultIdMethod="native">
>   <table name="TURBINE_PERMISSION">
>     <column name="PERMISSION_ID" required="true" primaryKey="true"
> type="INTEGER"/>
>     <column name="PERMISSION_NAME" required="true" size="99"
> type="VARCHAR"/>
>     <column name="OBJECTDATA" type="VARBINARY"/>
>     <unique>
>       <unique-column name="PERMISSION_NAME"/>
>     </unique>
>   </table>
> 
>   <table name="TURBINE_ROLE">
>     <column name="ROLE_ID" required="true" primaryKey="true"
type="INTEGER"/>
>     <column name="ROLE_NAME" required="true" size="99"
type="VARCHAR"/>
>     <column name="OBJECTDATA" type="VARBINARY"/>
>     <unique>
>         <unique-column name="ROLE_NAME"/>
>     </unique>
>   </table>
> 
> ...
> 
> The generated sql though is:
> 
> CREATE TABLE TURBINE_PERMISSION
> (
>       PERMISSION_ID integer NOT NULL,
>       PERMISSION_NAME varchar (99) NOT NULL,
>       OBJECTDATA bytea,
>     PRIMARY KEY (PERMISSION_ID),
>     CONSTRAINT TURBINE_PERMISSION_U_1 UNIQUE (PERMISSION_NAME)
> );
> 
> From the postgresql documentation:
> 
> "The primary key constraint specifies that a column or columns of a
table
>  may contain only unique (non-duplicate), non-NULL values.
Technically,
>  PRIMARY KEY is merely a combination of UNIQUE and NOT NULL, but
>  identifying a set of columns as primary key also provides meta-data
about
>  the design of the schema, as a primary key implies that other tables
may
>  rely on this set of columns as a unique identifier for rows."
> 
> So I guess this is really an error report on the documentation. The
> autoincrement="true" needs to be set on columns if you want a serial.
I
> haven't gotten to running turbine yet against this project, but I
suspect
> it is going to fail when the id is not set.
> 
> Will
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:turbine-torque-user-
> [EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:turbine-torque-user-
> [EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to