You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cayenne.apache.org by Tore Halset <ha...@pvv.ntnu.no> on 2007/07/30 10:19:55 UTC

Re: [JIRA] Created: (CAY-835) setting meaningful pk to zero turn on autogenerated keys

On Jul 30, 2007, at 9:44 , Andrus Adamchik wrote:

> Hi Tore,
>
> I suspect that this is a duplicate of CAY-811:
>
>    https://issues.apache.org/cayenne/browse/CAY-811
>
> Essentially any user provided value (not just zero) of a meaningful  
> PK is ignored if the PK is configured as DB-generated.
>
> Andrus

Okay, thanks. I closed 835 and commented on 811.

I now found a similar problem, but I do not know if it is the same.  
Having a CHAR(2) as the meaningful primary key (yes, it is a bad  
idea...) makes cayenne (after upgrading to 3.0M1) throw away the  
value I set and create its own numeric value. As "200" and "201" does  
not fit in a CHAR(2) the database throws a SQLException.

Do you think it is the same issue or should I register it?

Regards,
  - Tore.

Re: [JIRA] Created: (CAY-835) setting meaningful pk to zero turn on autogenerated keys

Posted by Andrus Adamchik <an...@objectstyle.org>.
> I now found a similar problem, but I do not know if it is the same.  
> Having a CHAR(2) as the meaningful primary key (yes, it is a bad  
> idea...) makes cayenne (after upgrading to 3.0M1) throw away the  
> value I set and create its own numeric value. As "200" and "201"  
> does not fit in a CHAR(2) the database throws a SQLException.

What PK-generation strategy is selected for this entity? "Default" or  
"Database-generated"?

> Do you think it is the same issue or should I register it?

I don't know... This may be a different kind of issue. Essentially  
Cayenne can not generate CHAR pks by definition, and probably should  
not attempt to. And afaik it won't if the strategy is "Default". Not  
sure what we should do if the user selects "Database-generated" in  
this case - probably show a validation warning in the Modeler?

Andrus




On Jul 30, 2007, at 11:19 AM, Tore Halset wrote:

> On Jul 30, 2007, at 9:44 , Andrus Adamchik wrote:
>
>> Hi Tore,
>>
>> I suspect that this is a duplicate of CAY-811:
>>
>>    https://issues.apache.org/cayenne/browse/CAY-811
>>
>> Essentially any user provided value (not just zero) of a  
>> meaningful PK is ignored if the PK is configured as DB-generated.
>>
>> Andrus
>
> Okay, thanks. I closed 835 and commented on 811.
>
> I now found a similar problem, but I do not know if it is the same.  
> Having a CHAR(2) as the meaningful primary key (yes, it is a bad  
> idea...) makes cayenne (after upgrading to 3.0M1) throw away the  
> value I set and create its own numeric value. As "200" and "201"  
> does not fit in a CHAR(2) the database throws a SQLException.
>
> Do you think it is the same issue or should I register it?
>
> Regards,
>  - Tore.
>


Re: [JIRA] Created: (CAY-835) setting meaningful pk to zero turn on autogenerated keys

Posted by Tore Halset <ha...@pvv.ntnu.no>.
On Jul 30, 2007, at 10:19 , Tore Halset wrote:

> I now found a similar problem, but I do not know if it is the same.  
> Having a CHAR(2) as the meaningful primary key (yes, it is a bad  
> idea...) makes cayenne (after upgrading to 3.0M1) throw away the  
> value I set and create its own numeric value. As "200" and "201"  
> does not fit in a CHAR(2) the database throws a SQLException.

Sorry. Forget this one. Created it myself...

  - Tore.