Good to hear. I'll open a Jira to change the adapter settings for DB2 to support this out of the box.

Andrus

On Jun 24, 2010, at 4:29 PM, Andrew Willerding wrote:

On 10-06-24 02:36 AM, Andrus Adamchik wrote:
Hi Andrew,

Not sure if that's related to your problem, but by default Db2Adapter is not setup to support identity columns (don't remember what the deal was back in the day when that setting was introduced... Most likely the driver didn't handle them correctly. Not sure if it does now).

You may try getting a hold of Db2Adapter instance (DataDomain -> DataNode -> DbAdapter; if it is set to "AutoAdapter", you can change it in the Modeler to "Custom Adapter" with the value of "org.apache.cayenne.dba.db2.DB2Adapter"), and then call

adapter.setSupportsGeneratedKeys(true);

Let us know the outcome - we may change the Cayenne defaults.

Cheers,
Andrus

On Jun 24, 2010, at 7:15 AM, Andrew Willerding wrote:

Hi Andrus

It took me a while to figure out how to get to the adapter in the code. I'm not used to accessing the "lower levels" of Cayenne but after some persistence (no pun intended) it WORKED! Thanks so much for your quick response!!

Here's what I did to check if the setting took hold.

System.out.println("************GEN KEYS SUPPORTED? -" + DataContext .createDataContext ().getParentDataDomain ().getNode("DataNode").getAdapter().supportsGeneratedKeys());


DB2Adapter ad = (DB2Adapter )DataContext .createDataContext ().getParentDataDomain().getNode("DataNode").getAdapter();
       ad.setSupportsGeneratedKeys(true);

System.out.println("************GEN KEYS SUPPORTED? -" + DataContext .createDataContext ().getParentDataDomain ().getNode("DataNode").getAdapter().supportsGeneratedKeys());


Andrew


Reply via email to