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 luke cassady-dorion <lu...@netraker.com> on 2003/04/16 18:53:58 UTC
clarification wrt primary keys
My current database is mssql (microsoft) server and I am using identity
columns to maintain per-table unique ids. I would like to continue using
this scheme in order to allow other clients besides ojb to modify my
data, but am not sure this is possible. I read the documentation for
SequenceManagerNextValImpl and this seems to imply that object ids need
to be unique across all tables. Is this correct or am I just
misunderstanding something.
Is it possible to use microsoft's identity key generation and not ojb's
scheme?
thnx
Re: clarification wrt primary keys
Posted by Armin Waibel <ar...@code-au-lait.de>.
Hi,
> My current database is mssql (microsoft) server and I am using
identity
> columns to maintain per-table unique ids. I would like to continue
using
> this scheme in order to allow other clients besides ojb to modify my
> data, but am not sure this is possible. I read the documentation for
> SequenceManagerNextValImpl and this seems to imply that object ids
need
> to be unique across all tables. Is this correct or am I just
> misunderstanding something.
No, there is no need for ids to be unique across all tables, they need
to be unique across all 'extents'. A small example to clear the term
'extent':
abstract class animal
| |
class dog class cat
Say you will be able to ask OJB for all 'animals' in system, then you
declare
animal in the repository file with the extents 'dog' and 'cat'.
<class-descriptor class="animal">
<extent-class class-ref="dog" />
<extent-class class-ref="cat" />
</class-descriptor>
... and class-descriptors for 'dog' and 'cat'
Now say dog and cat belongs to different database tables (they don't
have to, but they could), then the used ids for 'cat' and 'dog' have to
be
unique across these two tables - they have to 'extent aware'.
So if you don't split 'extents' across different tables you should not
run into problems using identity columns.
>
> Is it possible to use microsoft's identity key generation and not
ojb's
> scheme?
Now the nasty part starts... ;-)
Currently the is no sequence manager implementation supports
microsoft's identity key generation. I began write a common
native identifier based implementation (based on the sequence manger
for Mysql). If you interested in such an implementation I will send
you the source.
Another possibility is to handle this completely by your own.
regards,
Armin
>
> thnx
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
>