Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-16 Thread David Avendasora
On Mar 16, 2012, at 5:04 AM, Rich wrote: My only quandary around all this is if the PK is 'so' precious' to EOF and should never be 'used' Hold on, it's not that it is 'precious to EOF' it is that it is precious to the database. You can easily abuse PKs with any language, even just plain

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-15 Thread Rich
Hi Paul, Thanks, I'll have a look into that - I really new to WO, and still finding my feet, so was unaware of ERXGenericRecord. On 15/03/2012, at 6:22 PM, Paul Hoadley wrote: On 15/03/2012, at 3:25 PM, Rich wrote: Obviously NOT ideal, but unless anyone has a suggestion on a 'cleaner /

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-15 Thread David Avendasora
On Mar 15, 2012, at 4:00 PM, Rich wrote: Hi Paul, Thanks, I'll have a look into that - I really new to WO, and still finding my feet, so was unaware of ERXGenericRecord. On 15/03/2012, at 6:22 PM, Paul Hoadley wrote: On 15/03/2012, at 3:25 PM, Rich wrote: Obviously NOT ideal, but

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-15 Thread Kieran Kelleher
OK, at the risk of chastisement, I disagree with David A and probably all of my other friends! :-) (1) Don't make 'id' a class property - IIRC, it may cause problems with PK generation. (2) You *can* use a non-attribute PK named id (or whatever) as a sort *key* in a EOFetchSpecification

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-15 Thread Chuck Hill
On 2012-03-15, at 10:54 AM, Kieran Kelleher wrote: OK, at the risk of chastisement, I disagree with David A That is just sensible. and probably all of my other friends! :-) (1) Don't make 'id' a class property - IIRC, it may cause problems with PK generation. It is OK* to make the PK

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-15 Thread Ramsey Gurley
On Mar 15, 2012, at 11:03 AM, Chuck Hill wrote: On 2012-03-15, at 10:54 AM, Kieran Kelleher wrote: OK, at the risk of chastisement, I disagree with David A That is just sensible. and probably all of my other friends! :-) (1) Don't make 'id' a class property - IIRC, it may cause

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-15 Thread Chuck Hill
On 2012-03-15, at 11:41 AM, Ramsey Gurley wrote: Dave A's point still stands though. The ID is unique, but not necessarily in any particular order. I'd go with a dateCreated column populated in willInsert() or init(). Using the pk to determine the date created is just sloppy and will

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-15 Thread Ramsey Gurley
On Mar 15, 2012, at 11:46 AM, Chuck Hill wrote: On 2012-03-15, at 11:41 AM, Ramsey Gurley wrote: Dave A's point still stands though. The ID is unique, but not necessarily in any particular order. I'd go with a dateCreated column populated in willInsert() or init(). Using the pk to

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-15 Thread David Avendasora
On Mar 16, 2012, at 1:54 AM, Kieran Kelleher wrote: OK, at the risk of chastisement, I disagree with David A and probably all of my other friends! :-) Nah, I think you're take is probably the most common, and in some ways not entirely unreasonable. I've just been burned so many times by PKs

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-15 Thread Chuck Hill
On 2012-03-15, at 11:54 AM, Ramsey Gurley wrote: On Mar 15, 2012, at 11:46 AM, Chuck Hill wrote: On 2012-03-15, at 11:41 AM, Ramsey Gurley wrote: Dave A's point still stands though. The ID is unique, but not necessarily in any particular order. I'd go with a dateCreated column

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-15 Thread David Avendasora
On Mar 16, 2012, at 2:54 AM, Ramsey Gurley wrote: Uh oh... I think we both just agreed with Dave A! Is that why those 4 horsemen just road across the lawn!? Oh wait. Never mind. Those were just regular horsemen from the Sultan's (حفظه الله) polo grounds. Dave —

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-15 Thread Johann Werner
One case where the PK comes in handy is when using batched displaygroups and batched fetch specifications. I tend to add to any present (DB) sort ordering the id key to make the result set of the database deterministic. Otherwise I had sometimes the effect of getting some objects on

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-15 Thread Chuck Hill
On 2012-03-15, at 12:07 PM, David Avendasora wrote: On Mar 16, 2012, at 2:54 AM, Ramsey Gurley wrote: Uh oh... I think we both just agreed with Dave A! Is that why those 4 horsemen just road across the lawn!? Road? Is that the American English past tense of the verb to ride? What do

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-15 Thread Rich
Wow, nice lot of comments to wake up to this morning (Yea a late start as I had to get the kids to school). I do agree with all the points from everyone (how diplomatic is that!), and in 'Production' code I would never use the PK for anything - (probably ;o) However this really is only a quick

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-15 Thread Chuck Hill
On 2012-03-15, at 11:58 AM, David Avendasora wrote: On Mar 16, 2012, at 1:54 AM, Kieran Kelleher wrote: OK, at the risk of chastisement, I disagree with David A and probably all of my other friends! :-) Nah, I think you're take is probably the most common, and in some ways not

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-15 Thread Rich
On 16/03/2012, at 6:54 AM, Kieran Kelleher wrote: OK, at the risk of chastisement, I disagree with David A and probably all of my other friends! :-) (1) Don't make 'id' a class property - IIRC, it may cause problems with PK generation. (2) You *can* use a non-attribute PK named id (or

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-15 Thread Kieran Kelleher
On Mar 15, 2012, at 5:09 PM, Rich wrote: OK, at the risk of chastisement, I disagree with David A and probably all of my other friends! :-) (1) Don't make 'id' a class property - IIRC, it may cause problems with PK generation. (2) You *can* use a non-attribute PK named id (or

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-15 Thread Paul Hoadley
On 16/03/2012, at 4:24 AM, Kieran Kelleher wrote: (2) You *can* use a non-attribute PK named id (or whatever) as a sort *key* in a EOFetchSpecification you just can't use it for in-memory sort. EOSortOrdering s = new EOSortOrdering(id, EOSortOrdering.CompareAscending); BTW,

ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-14 Thread Rich
Hi guys, I can't seem to find a way to do a sort order based on the Entity objects Primary Key in an ERXRestFetchSpecification (the defaultSortOrdering specifier) I seem to be able to sort by any of the Attributes/Properties but not the PK (which I've called 'id') - Am I missing something

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-14 Thread Paul Yu
Why are you sorting on id column? My patterns is to use a displaySequence column. -- Paul Yu Sent with Sparrow (http://www.sparrowmailapp.com/?sig) On Wednesday, March 14, 2012 at 10:33 PM, Rich wrote: Hi guys, I can't seem to find a way to do a sort order based on the Entity objects

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-14 Thread Ray Kiddy
On Mar 14, 2012, at 7:33 PM, Rich wrote: Hi guys, I can't seem to find a way to do a sort order based on the Entity objects Primary Key in an ERXRestFetchSpecification (the defaultSortOrdering specifier) I seem to be able to sort by any of the Attributes/Properties but not the PK

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-14 Thread Rich
Hi Paul / Ray, I'm not doing any real display of the data, The WO site is purely a provider for a basic (Prototype) web-service and just returns the entity objects in JSON. What I want to do is a descending sort on the PK so only the latest batch of objects get returned. I know I could have a

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-14 Thread Rich
That sounds like what I'm missing ;o) - I haven't specifically set it, just presumed it would be available properety as it was being returned in the JSON representation Is it a big no-no to expose it and make it say a read-only property, and if so where would I do it if I'm not supposer to

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-14 Thread Rich
OK,' just to test', I set the 'id' property in the _MODEL_NAME class, which is probably a big-bad thing to do, but it works, and does exactly what I needed. Obviously NOT ideal, but unless anyone has a suggestion on a 'cleaner / propper' way to expose it, then I think it will suffice for the

Re: ERXRestFetchSpecification defaultSortOrderings ordered by id (PK)

2012-03-14 Thread Paul Hoadley
On 15/03/2012, at 3:25 PM, Rich wrote: Obviously NOT ideal, but unless anyone has a suggestion on a 'cleaner / propper' way to expose it, then I think it will suffice for the 'Prototype' - I'll change it in the 'production' version if it get's that far (honest) Assuming you're extending