You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Armin Waibel <ar...@code-au-lait.de> on 2003/05/09 23:07:22 UTC

Re: SequenceManager implementation.]

Hi Craig,

>
>
> -------- Original Message --------
> Subject: SequenceManager implementation.
> Date: Thu, 8 May 2003 23:55:24 +0200
> From: Craig Main <cr...@icon.co.za>
> To: <th...@apache.org>
>
>
>
> Hi Thomas,
>
> I am using OJB.
>
>
>
> I have written a Sequence Manager for sql server identity columns, but
> the afterStore method is getting called before the attempt to store
the
> object and the id is therefore zero. In addition, the autoincrement
> field has a specified value when the object is persisted. The
> autoincrement field should not appear in the value list if the
database
> is assigning the ID.
>
>
>
> How do I alter this behaviour?

I currently get a sequence manager implementation
working using hsql-identity columns. It's not perfect,
but my simple tests passed well.

If you interested in this solution i will send it to you.
If I done it well, you only need to change one line of code
to make it work with MSSQL.

I found the following pitfalls:
- set in field-descriptor attribute 'access' to readonly
for identity field
- let getUniqueLong(FieldDescriptor field) method
return a different non null ('0') value on each call, e.g. -1, ...
- let your database start identity values >0

regards,
Armin

>
>
>
> Kind Regards
>
> Craig
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>