Re: Using an auto incremented NSNumber as attribute in a NSManagedObject

2008-03-07 Thread Florent Pillet
> You could issue a fetch request at startup, store its @max in some > ivar in a MOC subclass, and use that instead of the local static > variable. > > Still a pain, but might do you what you want. I happen to have needed autoincrement properties too, and stumbled upon this post by David Emme:

Re: Using an auto incremented NSNumber as attribute in a NSManagedObject

2008-03-06 Thread I. Savant
Where would be the "ideal" spot to place this fetch request? -applicationDidFinishLaunching: ...? -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the mod

Re: Using an auto incremented NSNumber as attribute in a NSManagedObject

2008-03-06 Thread Joshua Preston
Kyle, Where would be the "ideal" spot to place this fetch request? Regards, Joshua Preston [EMAIL PROTECTED] On Mar 6, 2008, at 6:47 PM, Kyle Sluder wrote: You could issue a fetch request at startup, store its @max in some ivar in a MOC subclass, and use that instead of the local static v

Re: Using an auto incremented NSNumber as attribute in a NSManagedObject

2008-03-06 Thread Kyle Sluder
On Thu, Mar 6, 2008 at 5:32 PM, Joshua Preston <[EMAIL PROTECTED]> wrote: > Chris, > > The short answer is for quick look ups. My application creates a new > managed object which represents a new "issue". When the person done > with the entry completes it, they should be issued a "tracking >

Re: Using an auto incremented NSNumber as attribute in a NSManagedObject

2008-03-06 Thread Joshua Preston
Chris, The short answer is for quick look ups. My application creates a new managed object which represents a new "issue". When the person done with the entry completes it, they should be issued a "tracking number". For reasons ubiquitous with telephone support, I am attempting to only

Re: Using an auto incremented NSNumber as attribute in a NSManagedObject

2008-03-06 Thread Joshua Preston
I.S., Hence the "don't use in production" clause. That method starts at 1 every time the application is launched, so not the complete solution in my case, it was only there as a reference to incrementing a value (arguably for my own use). The idea would be to persist that number in the

Re: Using an auto incremented NSNumber as attribute in a NSManagedObject

2008-03-06 Thread Chris Hanson
On Mar 6, 2008, at 1:05 PM, Joshua Preston wrote: I am however having problems finding information regarding auto incremented attributes, namely an NSNumber attribute. What do you want to do with this? Core Data manages primary & foreign keys for you via object IDs and relationships, so yo

Re: Using an auto incremented NSNumber as attribute in a NSManagedObject

2008-03-06 Thread I. Savant
> - (void)awakeFromInsert > { > static int tempID = 1; > > [super awakeFromInsert]; > self.employeeID = [NSNumber numberWithInt:tempID++]; > } What do you think will happen when the application is quit, then run the next time? How will it remember the last tempID? -- I.S. ___

Re: Using an auto incremented NSNumber as attribute in a NSManagedObject

2008-03-06 Thread Joshua Preston
First, a little head way... According to some cached documentation (thanks google!) I've located a snippet that appears to do exactly what I require, however, there's a nice notice saying NOT to use this in a production environment. Taking that as a queue, I am assuming that persisting the

Re: Using an auto incremented NSNumber as attribute in a NSManagedObject

2008-03-06 Thread Keary Suska
on 3/6/08 2:05 PM, [EMAIL PROTECTED] purportedly said: > For example, when I create my first object, I want the numeric id > field to be 1. Each subsequent insert should be the previous numeric > id field + 1. I've read some of the posts regarding performing this > and the general thought on thi

Re: Using an auto incremented NSNumber as attribute in a NSManagedObject

2008-03-06 Thread Hank Heijink (Mailinglists)
It's a little busy at the developer website, since they just announced the iPhone SDK. I think there's nothing to do but wait... Best, Hank On Mar 6, 2008, at 4:05 PM, Joshua Preston wrote: Hey guys, First, let me say that I'm just starting to pick up Cocoa and Objective-C, and so far, I

Using an auto incremented NSNumber as attribute in a NSManagedObject

2008-03-06 Thread Joshua Preston
Hey guys, First, let me say that I'm just starting to pick up Cocoa and Objective-C, and so far, I love it. Core Data seems to be an elegant solution to some of my past problems (mainly Java persistence). I am however having problems finding information regarding auto incremented attrib