Compound primary key generation issue
Compound primary key generation issue
- Subject: Compound primary key generation issue
- From: Brendan Duddridge <email@hidden>
- Date: Sun, 20 Mar 2005 12:56:17 -0700
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