discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GDL2 problem


From: Edwin Ancaer
Subject: Re: GDL2 problem
Date: Sat, 13 Jun 2015 11:37:52 +0200

Replace @"Persons" by @"persons" in
 authorsDS = [[EODatabaseDataSource alloc] initWithEditingContext: ec entityName:@"persons"];
and the  error goes away, you old fool.

And go get yourself another rubber duck....

But I still don't see how authorsDS  gets the info from aModel, unless the globalModelGroup is somewhere available for all EOF classes...


2015-06-13 10:18 GMT+02:00 Edwin Ancaer <eancaer@gmail.com>:
I created an application , and tried to integrate some code I found in
http://www.gnustep.org/resources/documentation/Developer/GDL2/GDL2Intro.pdf.

The code (sloppy, with unused variables) in ApplicationDidFinishLaiunching looks as follows:


- (void) applicationDidFinishLaunching: (NSNotification *)aNotif
{
// Uncomment if your application is Renaissance-based
//  [NSBundle loadGSMarkupNamed: @"Main" owner: self];
  EODatabaseContext *aDatabaseContext;
  EOModelGroup *aModelGroup;
  EODatabase *aDatabase;
  EOModel *aModel;
  EOAdaptor *adaptor;
  EOAdaptorContext *context;
  EOAdaptorChannel *channel;
  EOEditingContext *ec;
  EODatabaseDataSource *authorsDS;
  EODataSource *booksDS;
  id author;
  id book; 
 
  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
  aModelGroup = [EOModelGroup globalModelGroup];
  aModel = [aModelGroup modelNamed:@"MultiDB"];
  NSLog(@"model initialized? %@", aModel);

  adaptor = [EOAdaptor adaptorWithModel:aModel];
  NSLog(@"adaptor initialized? %@", adaptor);
  NSLog(@"model in adaptor? %@", [adaptor model]);

  context = [adaptor createAdaptorContext];
  NSLog(@"context initialized? %@", context);

  channel = [context createAdaptorChannel];
  NSLog(@"channel initialized? %@", channel);

  ec = [[EOEditingContext alloc] init];
  NSLog(@"editing context initialized? %@", ec);

  authorsDS = [[EODatabaseDataSource alloc] initWithEditingContext: ec entityName:@"Persons"];
  NSLog(@"data source initialized? %@", authorsDS);

  [pool release];

}

This is the end of the NSLOG output:

2015-06-13 09:49:22.758 Crud[10089:10089] editing context initialized? <EOEditingContext: 0x8c8a6b8>
2015-06-13 09:49:22.759 Crud[10089:10089] Problem posting notification: <NSException: 0x8c9da60> NAME:NSInvalidArgumentException REASON:adaptorWithModel: -- EOAdaptor 0xb695c9f0: no model specified INFO:(null)

I suspect the error is at initializing the variable AuthorsDS, (the complete output is in the attached file).

What I don't get is how authorsDS is linked to the prevously created model aModel since I just did alloc - init for the editingcontext.

In that sense it seems logic that no model is found and an error occurs.

Can someone help with this?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]