Cayenne should not disregard user-made decisions: it isn't Cayenne's
responsibility to enforce PK integrity.
It will not disregard the user decisions. If I understood correctly
what you are trying to do, my recommendation would be this:
MyObject object = context.newObject(MyObject.class);
object.getObjectId().getReplacementIdMap().put("PK_COLUMN", value);
When you said "PK is set through the ObjectID map", did you mean the
API above or something else? AFAIK the approach above should work.
Andrus
On Feb 20, 2008, at 8:31 PM, Scott Anderson wrote:
It looks like there's no model that fits what I'd like to do. IMO, the
user should be able to specify the PK in DB-generated mode when either
the field is exposed, or the PK is set through the ObjectID map.
Cayenne
should not disregard user-made decisions: it isn't Cayenne's
responsibility to enforce PK integrity.
-----Original Message-----
From: Aristedes Maniatis [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 20, 2008 2:01 AM
To: [email protected]
Subject: Re: Specifying PK when creating a new object in DB
generated PK
mode
On 20/02/2008, at 9:51 AM, Scott Anderson wrote:
I am working an a request ticket system, similar to the one I'm using
to enter this issue. I need to import requests from the old schema to
the new schema, and the PKs must be specified while doing an import.
When using the tool normally, the PKs must be database generated. Is
there any way to do this?
You can specify the key yourself easily:
http://cayenne.apache.org/doc/primary-key-generation.html
But I can't see how you can guarantee you will not get collisions
between your two schemes. Maybe better to keep the old key in a
separate
field for reference purposes.
Ari Maniatis