Hi Andrés.

Thanks for your help.

I will test it tonight at home.

Cheers

Felipe

-----Original Message-----
From: Andrus Adamchik [mailto:[EMAIL PROTECTED] 
Sent: Wednesday 04 October 2006 16:48
To: [email protected]
Subject: Re: Database Generated Ids

Hi Felipe,

Here is a docs page on auto-incremented keys:

http://cwiki.apache.org/confluence/display/CAYDOC/Generated+Columns

Also see my comments below...


On Oct 4, 2006, at 3:13 AM, DOMINGUEZ Felipe wrote:
> Hello every body.
>
>
> I am using Cayenne to query hsqldb.
>
> On HSQLDB I have a few tables with an auto-increment  primary key.  
> When
> I manually enter data onto those tables the key generation works fine.
>
> On the other hand cayenne always uses its own key generation,  
> generating
> PK with the support of table AUTO_PK_SUPPORT.
>
> I did some research last night and I found out that I must set the
> database custom adapter in the DomainNode adapter panel, so I set  
> it to
> org.objectstyle.cayenne.dba.hsqldb.HSQLDBAdapter

No, in 1.2 and newer this is optional. But you still want to do that  
if you are to follow the advice below.

> But still, Cayenne uses AUTO_PK_SUPPORT


True, there are two things involved in making auto-increment work.  
First you must select "Database-Generated" for "PK Generation  
Strategy" for each table in question. Second - Cayenne DbAdapter must  
support it. HSQLDB adapter thinks that it doesn't (although in fact  
it does), so you'll need to manually flip Auto PK flag:

DataNode node = ...
JdbcAdapter adapter = (JdbcAdapter) node.getAdapter();
adapter.setSupportsGeneratedKeys(true);

(I'll log an issue in Jira to make sure Cayenne does the right thing  
in the future).

Andrus



____

This message and any files transmitted with it are legally privileged and 
intended for the sole use of the individual(s) or entity to whom they are 
addressed. If you are not the intended recipient, please notify the sender by 
reply and delete the message and any attachments from your system. Any 
unauthorised use or disclosure of the content of this message is strictly 
prohibited and may be unlawful.

Nothing in this e-mail message amounts to a contractual or legal commitment on 
the part of EUROCONTROL, unless it is confirmed by appropriately signed hard 
copy.

Any views expressed in this message are those of the sender.

Reply via email to