Pierre -- Pierre Frisch [EMAIL PROTECTED]
On Jan 5, 2008, at 16:25, Don Lindsay wrote:
He,he;That is what confused me, I expected it to be an EOGenericRecord and not a plain object.Thanks again for your help. Don On Jan 5, 2008, at 7:20 PM, Miguel Arroz wrote:Hi!databaseContextNewPrimaryKey NSDictionary databaseContextNewPrimaryKey(EODatabaseContext dbCtxt, Object object, EOEntity entity)Invoked if the newly inserted Enterprise Object object doesn't have a primary key set. The delegate can implement custom primary key generation, or return null, in which case the database context dbCtxt will send a primaryKeyForNewRowWithEntity message to an EOAdaptorChannel to generate the key. Should return a dictionary containing the attribute or attributes (if object has a compound primary key) that make up object's primary key, or null to have the database context generate the primary key.Parameters: dbCtxt - The database context. object - A newly inserted Enterprise Object. entity - The EOEntity object for primary key generation. Returns:Should return a dictionary containing the attribute or attributes that make up object's primary key, or null.See Also: EOAdaptorChannel#primaryKeyForNewRowWithEntity( EOEntity entity)<http://developer.apple.com/documentation/MacOSXServer/Reference/WO54_Reference/com/webobjects/eoaccess/EODatabaseContext.Delegate.html#databaseContextNewPrimaryKey(com.webobjects.eoaccess.EODatabaseContext,%20java.lang.Object,%20com.webobjects.eoaccess.EOEntity) >I think so. I don't know why they made in an Object and not an EOEnterpriseRecord, but I'm dumb, so there's probably a good reason. :)Yours Miguel Arroz On 2008/01/06, at 00:11, Don Lindsay wrote:Hello the second parameter to the function, is it the object that is going to be inserted?Thanks, donpublic NSDictionary databaseContextNewPrimaryKey(EODatabaseContext dbCtxt, Object object, EOEntity entity) {NSMutableDictionary newPrimaryKey = new NSMutableDictionary(); NSArray entityPrimaryKeys = entity.primaryKeyAttributeNames(); ... return newPrimaryKey; } On Jan 5, 2008, at 6:20 PM, Don Lindsay wrote:Thank you all for your help. Don On Jan 5, 2008, at 5:46 PM, Miguel Arroz wrote:Hi!And check this out too: <http://developer.apple.com/documentation/WebObjects/Enterprise_Objects/Saving/chapter_8_section_8.html#//apple_ref/doc/uid/TP30001011-CH208-BADJEBIB >.Never used compound keys myself, so I can't help much more. Good luck!Yours Miguel Arroz On 2008/01/05, at 22:37, David LeBer wrote:On 5-Jan-08, at 5:16 PM, Don Lindsay wrote:Hello;One of the primary keys is a date field, how would the system set this date?If your model is not written in stone, I'd recommend you model a separate PK devoid of any real value beyond being a DB artifact. Your life will be easier in the long run.If making changes is not an option, you can look here for details on custom PK generation:<http://developer.apple.com/documentation/WebObjects/Enterprise_Objects/Saving/chapter_8_section_7.html >don On Jan 5, 2008, at 5:11 PM, Miguel Arroz wrote:Hi! On 2008/01/05, at 22:05, Don Lindsay wrote:I am using an oracle database. Anytime I attempt to insert a record in any table I get the following error:[EMAIL PROTECTED] failed to provide new primary keys for entity 'WeaponAssignment'I have set all of the primary key attributes before attempting to insert the object. So I am kind of confused why I keep receiving this message.I don't understand what you mean by this. You have set the primary keys manually on the object? If you did, than that's the problem, that's the job of EOF, not yours. :)Yours Miguel Arroz;david -- David LeBer Codeferous Software 'co-def-er-ous' adj. Literally 'code-bearing' site: http://codeferous.com blog: http://davidleber.net profile: http://www.linkedin.com/in/davidleber -- Toronto Area Cocoa / WebObjects developers group: http://tacow.org _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/arroz%40guiamac.com This email sent to [EMAIL PROTECTED]Miguel Arroz http://www.terminalapp.net http://www.ipragma.com_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/pccdonl%40mac.com This email sent to [EMAIL PROTECTED]Miguel Arroz http://www.terminalapp.net http://www.ipragma.com_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/pierre%40apple.com This email sent to [EMAIL PROTECTED]
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
