Re: Compound primary key generation issue
Re: Compound primary key generation issue
- Subject: Re: Compound primary key generation issue
- From: King Chung Huang <email@hidden>
- Date: Sun, 20 Mar 2005 18:24:40 -0700
Perhaps one (or both) of the relationships from Locale to
LocalizedFedProduct or FedProduct to LocalizedFedProduct doesn't have
"Propagate Primary Key" checked off in the EOModel?
King Chung Huang
On Mar 20, 2005, at 12:56 PM, Brendan Duddridge wrote:
Hi,
I have an issue with EOF generating an SQL call to get a new primary
key
from the database, even though the entity I’m creating has a compound
primary key that’s already comprised of 2 foreign keys.
My database is FrontBase and this is what it generates to get the
primary
key:
SELECT UNIQUE FROM "LOCALIZED_FED_PRODUCT".
The problem is, there is no need to go to the database to get a
primary key.
My LocalizedFedProduct entity has localeId, productId, and name
attributes.
localeId is a foreign key to my Locale entity. productId is a foreign
key to
my FedProduct entity. The keys together form the primary key for the
entity.
I create a LocalizedFedProduct with the following code:
LocalizedFedProduct fedProduct = EOUtilities.createAndInsertObject(ec,
"LocalizedFedProduct");
fedProduct.setLocale(aLocale);
fedProduct.setProduct(aProduct);
FedProduct.setName("some localized product name");
Where aLocale and aProduct are pre-existing entities and ec is the
editing
context.
Do you have any idea why EOF would be trying to ask the database for a
primary key in this situation? And how to prevent it from doing that?
Thanks,
___________________________
Brendan Duddridge
ClickSpace Interactive Inc.
Suite L100
239 - 10th Ave SE
Calgary, AB T2G 0V9
Canada
(403) 277-5591
http://www.clickspace.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden