You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Marc Gabriel-Willem <ma...@side-international.com> on 2007/06/14 16:59:01 UTC

Identity PK value

Dear all,

 

We have a problem regarding the PK value access. 

My db schema and my business logic require me to get the next identity
of a particular table before inserting the new record.

 

We must use the identity column defined at the table level (cannot use a
stored procedure + pk specific table management).

 

May be the PkGenerator class could be useful for us, but it seems a
stored procedure is required (not a good option for us).

 

So, is there a way to get the current identity value (+ 1) defined on a
particular table using cayenne ?

We know this is not a good practise, but we cannot change our model
easily.

 

Thank you in advance for your help.

 

Marc Gabriel


------------------------------------------------------------------
CONFIDENTIALITY: This e-mail and any files transmitted with it are confidential and intended solely for the use of the recipient(s) only. Any review, retransmission, dissemination or other use of, or taking any action in reliance upon this information by persons or entities other than the intended recipient(s) is prohibited. If you have received this e-mail in error please notify the sender immediately and destroy the material whether stored on a computer or otherwise.

DISCLAIMER: Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of SIDE International S.A. - EastNets Group, unless otherwise specifically stated. 
------------------------------------------------------------------



Re: Identity PK value

Posted by Andrus Adamchik <an...@objectstyle.org>.
BTW, is "identity column" autogenerated by DB by any chance? And  
which DB is that?

Maybe you can use this mechanism:

http://cayenne.apache.org/doc20/generated-columns.html

Andrus




On Jun 15, 2007, at 4:32 PM, Mike Kienenberger wrote:

> It's relatively easy to build your own custom PK generator, using
> whatever logic you want.
> Take a look at the various database implementations for examples, such
> as the OpenBase one.
>
> On 6/14/07, Marc Gabriel-Willem
> <ma...@side-international.com> wrote:
>> Dear all,
>>
>>
>>
>> We have a problem regarding the PK value access.
>>
>> My db schema and my business logic require me to get the next  
>> identity
>> of a particular table before inserting the new record.
>>
>>
>>
>> We must use the identity column defined at the table level (cannot  
>> use a
>> stored procedure + pk specific table management).
>>
>>
>>
>> May be the PkGenerator class could be useful for us, but it seems a
>> stored procedure is required (not a good option for us).
>>
>>
>>
>> So, is there a way to get the current identity value (+ 1) defined  
>> on a
>> particular table using cayenne ?
>>
>> We know this is not a good practise, but we cannot change our model
>> easily.
>>
>>
>>
>> Thank you in advance for your help.
>>
>>
>>
>> Marc Gabriel
>>
>>
>> ------------------------------------------------------------------
>> CONFIDENTIALITY: This e-mail and any files transmitted with it are  
>> confidential and intended solely for the use of the recipient(s)  
>> only. Any review, retransmission, dissemination or other use of,  
>> or taking any action in reliance upon this information by persons  
>> or entities other than the intended recipient(s) is prohibited. If  
>> you have received this e-mail in error please notify the sender  
>> immediately and destroy the material whether stored on a computer  
>> or otherwise.
>>
>> DISCLAIMER: Any views or opinions presented within this e-mail are  
>> solely those of the author and do not necessarily represent those  
>> of SIDE International S.A. - EastNets Group, unless otherwise  
>> specifically stated.
>> ------------------------------------------------------------------
>>
>>
>>
>


Re: Identity PK value

Posted by Mike Kienenberger <mk...@gmail.com>.
It's relatively easy to build your own custom PK generator, using
whatever logic you want.
Take a look at the various database implementations for examples, such
as the OpenBase one.

On 6/14/07, Marc Gabriel-Willem
<ma...@side-international.com> wrote:
> Dear all,
>
>
>
> We have a problem regarding the PK value access.
>
> My db schema and my business logic require me to get the next identity
> of a particular table before inserting the new record.
>
>
>
> We must use the identity column defined at the table level (cannot use a
> stored procedure + pk specific table management).
>
>
>
> May be the PkGenerator class could be useful for us, but it seems a
> stored procedure is required (not a good option for us).
>
>
>
> So, is there a way to get the current identity value (+ 1) defined on a
> particular table using cayenne ?
>
> We know this is not a good practise, but we cannot change our model
> easily.
>
>
>
> Thank you in advance for your help.
>
>
>
> Marc Gabriel
>
>
> ------------------------------------------------------------------
> CONFIDENTIALITY: This e-mail and any files transmitted with it are confidential and intended solely for the use of the recipient(s) only. Any review, retransmission, dissemination or other use of, or taking any action in reliance upon this information by persons or entities other than the intended recipient(s) is prohibited. If you have received this e-mail in error please notify the sender immediately and destroy the material whether stored on a computer or otherwise.
>
> DISCLAIMER: Any views or opinions presented within this e-mail are solely those of the author and do not necessarily represent those of SIDE International S.A. - EastNets Group, unless otherwise specifically stated.
> ------------------------------------------------------------------
>
>
>