You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Andrzej Jan Taramina <an...@chaeron.com> on 2003/10/17 17:58:18 UTC

Re: Modular DB Actions, MS SQLServer and AutoIncrement columns? SOLVED

> I'm trying to figure out how to use MS SQLServer 2K's Identity columns as a
> primary key, which automatically generate a new value for the field when using
> Modular DB Actions to do an insert.
> 
> I kinda thought it should look like this for an identity column called "id" in
> the database descriptor:
> 
> <key name="id" type="int" autoincrement="true">
>  <mode name="auto" type="autoincr"/>
> </key>
> 
> But it didn't work.....the DatabasAddAction tried to insert the value for the
> actual key, and SQLServer punted that since you can't manually set identity
> columns.

Using the Manual AutoIncrement module was the source of the trouble when I 
had the key field set as an SQLServer Identity field.

So I wrote a quick SQLServer Identity AutoIncrement module for Cocoon that 
resolved this issue for me.  It's called 
org.apache.cocoon.components.modules.database.SQLServerIdentityAutoIncrementMo
dule
and was modelled on the hsqldb version that comes with Cocoon 2.1.2.

Maybe one of the developers would be interested in adding this for Cocoon 
2.1.3?

Yours for the asking if you want it.  ;-)


Andrzej Jan Taramina
Chaeron Corporation: Enterprise System Solutions
http://www.chaeron.com


Re: Modular DB Actions, MS SQLServer and AutoIncrement columns? SOLVED

Posted by Geoff Howard <co...@leverageweb.com>.
Andrzej Jan Taramina wrote:
>>I'm trying to figure out how to use MS SQLServer 2K's Identity columns as a
>>primary key, which automatically generate a new value for the field when using
>>Modular DB Actions to do an insert.
>>
>>I kinda thought it should look like this for an identity column called "id" in
>>the database descriptor:
>>
>><key name="id" type="int" autoincrement="true">
>> <mode name="auto" type="autoincr"/>
>></key>
>>
>>But it didn't work.....the DatabasAddAction tried to insert the value for the
>>actual key, and SQLServer punted that since you can't manually set identity
>>columns.
> 
> 
> Using the Manual AutoIncrement module was the source of the trouble when I 
> had the key field set as an SQLServer Identity field.
> 
> So I wrote a quick SQLServer Identity AutoIncrement module for Cocoon that 
> resolved this issue for me.  It's called 
> org.apache.cocoon.components.modules.database.SQLServerIdentityAutoIncrementMo
> dule
> and was modelled on the hsqldb version that comes with Cocoon 2.1.2.
> 
> Maybe one of the developers would be interested in adding this for Cocoon 
> 2.1.3?
> 
> Yours for the asking if you want it.  ;-)

Can you submit it as a [PATCH] to bugzilla?

Geoff


Re: Modular DB Actions, MS SQLServer and AutoIncrement columns? SOLVED

Posted by Christian Haul <ha...@informatik.tu-darmstadt.de>.
Andrzej Jan Taramina wrote:

> So I wrote a quick SQLServer Identity AutoIncrement module for Cocoon that 
> resolved this issue for me.  It's called 
> org.apache.cocoon.components.modules.database.SQLServerIdentityAutoIncrementMo
> dule
> and was modelled on the hsqldb version that comes with Cocoon 2.1.2.
> 
> Maybe one of the developers would be interested in adding this for Cocoon 
> 2.1.3?

Sure.

	Chris.

-- 
C h r i s t i a n       H a u l
haul@informatik.tu-darmstadt.de
     fingerprint: 99B0 1D9D 7919 644A 4837  7D73 FEF9 6856 335A 9E08