Chris Miller wrote:
>
> Hi all,
>
> This is possibly more of a generic EJB question, although maybe not since
> Orion has to implement the persistence...
>
> I was wondering if it is possible to use CMP beans against an existing
> SQL-Server database that has autoincrement primary keys. It's not possible
> to insert a value for the key (have to supply null), so using something like
> counter.jar to override the PK generation is not an option. Has anyone done
> this successfully? What's the trick, or am I stuck with BMP (as I suspect is
> the case)?
>
Using auto incrementing fields in EJB is not very usefull since they may
map to databases not supporting such features, it's just like stored
procedures. They might seem to look like a good idea, but it just makes
the application much less portable.
Orion includes an EJB which can generate a unique id for you, it's in
counter.jar (I think you can find it in the news app).
However if you really have to use an existing DB, you're either stuck
with using BMP or you could write an entitybean (CMP) which only does
the updates for you and may delete te bean by calling remove on the bean
and a stateles session bean that handles the insertions for you.
sven
--
======================================================================================
Sven E. van 't Veer
http://www.cachoeiro.net
Java Developer [EMAIL PROTECTED]
======================================================================================