Re: [Modeling-users] Query bug when not using ec.saveChanges
Status: Abandoned
Brought to you by:
sbigaret
From: Sebastien B. <sbi...@us...> - 2004-08-12 22:24:39
|
Ernesto Revilla wrote: > Dear all, > > just a question: can't I fetch objects by attribute access, without > having used ec.saveChanges first? See the last 4 lines of the > following source code. What restrictions exist using fetch, in respect > with ec.saveChanges? > > Thanx, > Erny [example snipped] To be perfectly clear: there should not exist such a restriction. I'm currently away from any development environment, with an access to my emails but that's all, so I'm not able to check and diagnose this. You have found a bug for sure --even if, for now, I cannot be completely positive about the fact that it can be easily solved. Anyhow, thanks for reporting! may I ask you to fill a bug report? I'll get back to you next week (I can't say exactly when, I'll be extremely busy for the 10 coming days). In case you're in a hurry, you may want to check this by yourself by checking EditingContext.fetch(): at the end of it, it applies the qualifier (here, 'reservations.startDay like "2004-08-09*"') to its inserted objects of the correct type/entity. I suspect that you get no objects because the 'like' operator tries to compare a string to a Date object, which obviously never selects any object. If this is the case, then the solution is probably to check the type of the destination attribute (startDay), and, if it is a date, then adjust the qualifier's value accordingly (may be changing the operator from 'like' to 'between'); or an other (more efficient?) solution could be to compare the string with the string representation of the attribute's value... but this would add the constraint that such a string representation should be the same than the database's representation for dates... Oh well, anyhow, you get the idea, don't you?-) I'm pretty confident that the bug is only triggered with attributes whose type is Date. -- Sébastien. |