Sorry, to interrupt , but I turned on SQL logging and the and found that the EOModeler fetchspec that works genereates the following SQL
evaluateExpression: <com.webobjects.jdbcadaptor.PostgresqlExpression: "SELECT t0.assemblyTransaction_id, t0.averageCost, t0.billNumber, t0.contact_id, t0.cost, t0.dateEnd, t0.dateStart, t0.id, t0.location_id, t0.locked, t0.note, t0.part_id, t0.project_id, t0.purchaseOrder, t0.quantity, t0.receptionNumber, t0.reversedTransaction_id, t0.runningTotalCost, t0.runningTotalQty FROM Transaction t0 INNER JOIN Part T1 ON t0.part_id = T1.id WHERE T1.spec_id = ?::int4 ORDER BY t0.dateEnd ASC, t0.id ASC" withBindings: 1:4855(spec_id)>
while the non functioning EOModler fetchspec generates
evaluateExpression: <com.webobjects.jdbcadaptor.PostgresqlExpression: "SELECT t0.assemblyTransaction_id, t0.averageCost, t0.billNumber, t0.contact_id, t0.cost, t0.dateEnd, t0.dateStart, t0.id, t0.location_id, t0.locked, t0.note, t0.part_id, t0.project_id, t0.purchaseOrder, t0.quantity, t0.receptionNumber, t0.reversedTransaction_id, t0.runningTotalCost, t0.runningTotalQty FROM Transaction t0 INNER JOIN Part T1 ON t0.part_id = T1.id WHERE (T1.spec_id = ?::int4 AND t0.dateEnd < ?::timestamp) ORDER BY t0.dateEnd DESC, (t0.id)" withBindings: 1:4855(spec_id), 2:2011-01-25 14:07:36.0(dateEnd)>
While investigating, I toggled the sort orders of both fetchspecs and retested to see how it affected the generated SQL. After a few combinations, I noticed the EOModeler order started sticking and I was getting the desired sort ordering !
Feb 20 23:34:54 DEBUG NSLog - evaluateExpression: <com.webobjects.jdbcadaptor.PostgresqlExpression: "SELECT t0.assemblyTransaction_id, t0.averageCost, t0.billNumber, t0.contact_id, t0.cost, t0.dateEnd, t0.dateStart, t0.id, t0.location_id, t0.locked, t0.note, t0.part_id, t0.project_id, t0.purchaseOrder, t0.quantity, t0.receptionNumber, t0.reversedTransaction_id, t0.runningTotalCost, t0.runningTotalQty FROM Transaction t0 INNER JOIN Part T1 ON t0.part_id = T1.id WHERE (T1.spec_id = ?::int4 AND t0.dateEnd < ?::timestamp) ORDER BY t0.dateEnd DESC, t0.id DESC" withBindings: 1:4855(spec_id), 2:2011-01-25 14:07:36.0(dateEnd)>
So , good for now, but it seems like a possible bug in the Sort Orderings editor pane of EOModler. Next time this happens, I'll try to check the .fspec files to see if it matches EOModeler.
Cheers.
On 2011-02-20, at 21:46 , Louis Demers wrote: On 2011-02-20, at 21:39 , Louis Demers wrote: Please note that the sorting on the NSTimestamp seems to work, it's just that the sort on the primary does not when it's in reverse..
let me add that according to what I'm trying to do the latest should be the record with larger primary key on the same date sot it should be last transaction on 2011-01-20
|