You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Manuel Thiemann <ma...@web.de> on 2007/03/01 10:53:25 UTC

"PK Generation Strategy: Database-Generated" doesn't work

Hello,

I just started playing a bit with Cayenne to find out how things work. 
Therefore I created a database (HSQL) with a single table and in the 
CayenneModeler set "Primary Key Generation Strategy" to 
"Database-Generated" and the "Auto Increment" field to "ID (INTEGER)" 
which is the column defined as Primary Key at the attributes tab. 
However when I try to insert a row in my test program I get an exception 
because I don't have an AUTO_PK_SUPPORT table in my database. But as far 
as I understand I don't not need this table if primary keys are 
generated by the database itself. Is there something else I have to 
configure to not need to have that table (It works fine if I create that 
table via "Generate Database Schema" but I would prefer to have the 
database doing that primary key stuff. Or is there any reason that it is 
better to use AUTO_PK_SUPPORT)?

Thanx for help.

Manuel

Re: "PK Generation Strategy: Database-Generated" doesn't work

Posted by Manuel Thiemann <ma...@web.de>.
Hi Andreas,

thank you very much for your quick reply.

I want to apologize for for sending this question twice. After receiving 
a request to confirm my subscription to the mailing list today I assumed 
that the mail I sent yesterday were rejected because the subscription 
was not yet activated and I didn't get any confirmation until short 
after I sent it a second time. I'm sorry for that.

Manuel

Andrus Adamchik wrote:
> Hi Manuel,
> 
> Per http://cayenne.apache.org/doc/generated-columns.html DB-generated pk 
> depends on support of this feature by the underlying JDBC driver. Our 
> testing showed that it only works in MySQL, Derby and SQLServer. For 
> HSQLDB this feature is turned off (I just tried it on HSQL 1.8.0.4 - the 
> driver support isn't there), so Cayenne behavior is to fail over to the 
> AUTO_PK_SUPPORT lookup table.
> 
> As auto-increment feature makes it to other JDBC drivers (including 
> HSQL), we'll turn it on in Cayenne accordingly.
> 
> Andrus
> 
> On Mar 1, 2007, at 11:53 AM, Manuel Thiemann wrote:
> 
>> Hello,
>>
>> I just started playing a bit with Cayenne to find out how things work. 
>> Therefore I created a database (HSQL) with a single table and in the 
>> CayenneModeler set "Primary Key Generation Strategy" to 
>> "Database-Generated" and the "Auto Increment" field to "ID (INTEGER)" 
>> which is the column defined as Primary Key at the attributes tab. 
>> However when I try to insert a row in my test program I get an 
>> exception because I don't have an AUTO_PK_SUPPORT table in my 
>> database. But as far as I understand I don't not need this table if 
>> primary keys are generated by the database itself. Is there something 
>> else I have to configure to not need to have that table (It works fine 
>> if I create that table via "Generate Database Schema" but I would 
>> prefer to have the database doing that primary key stuff. Or is there 
>> any reason that it is better to use AUTO_PK_SUPPORT)?
>>
>> Thanx for help.
>>
>> Manuel
>>
> 
> 

Re: "PK Generation Strategy: Database-Generated" doesn't work

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Manuel,

Per http://cayenne.apache.org/doc/generated-columns.html DB-generated  
pk depends on support of this feature by the underlying JDBC driver.  
Our testing showed that it only works in MySQL, Derby and SQLServer.  
For HSQLDB this feature is turned off (I just tried it on HSQL  
1.8.0.4 - the driver support isn't there), so Cayenne behavior is to  
fail over to the AUTO_PK_SUPPORT lookup table.

As auto-increment feature makes it to other JDBC drivers (including  
HSQL), we'll turn it on in Cayenne accordingly.

Andrus

On Mar 1, 2007, at 11:53 AM, Manuel Thiemann wrote:

> Hello,
>
> I just started playing a bit with Cayenne to find out how things  
> work. Therefore I created a database (HSQL) with a single table and  
> in the CayenneModeler set "Primary Key Generation Strategy" to  
> "Database-Generated" and the "Auto Increment" field to "ID  
> (INTEGER)" which is the column defined as Primary Key at the  
> attributes tab. However when I try to insert a row in my test  
> program I get an exception because I don't have an AUTO_PK_SUPPORT  
> table in my database. But as far as I understand I don't not need  
> this table if primary keys are generated by the database itself. Is  
> there something else I have to configure to not need to have that  
> table (It works fine if I create that table via "Generate Database  
> Schema" but I would prefer to have the database doing that primary  
> key stuff. Or is there any reason that it is better to use  
> AUTO_PK_SUPPORT)?
>
> Thanx for help.
>
> Manuel
>