Re: [Modeling-users] Some more questions
Status: Abandoned
Brought to you by:
sbigaret
From: Sebastien B. <sbi...@us...> - 2003-09-17 11:54:03
|
"Ernesto Revilla" <er...@si...> wrote: > Hi again, >=20 > Queries with large resultsets: > I remember I read about this but I don't see where. What is returned > for a fetch with a result set of, say, 10000 rows? A list? Or an > iterator? Is there a concept like database cursors, which iterate over > objects (wherever they are stored), instead of database rows? A list, yes, either a list of objects or a list of dictionaries if you fetch with 'rawRows=3D1' (which is probably what you need for such a large number of objects). There are some pending works for supporting OFFSET and LIMIT, but this is still unfinished. > Multi-user environment: > I read the deployment instructions of the user doc. Under SQLite, when > two separe editing context (either different applications or one > application but different editing context) save changes to the same > object, the latter one overwrites silently the earlier ones, which is > not that nice. Does this behave the same way with Postgres? And with > mySQL? The current default database policy is: no locking, which basically means that no checks are done, ever. I do not know what you would need in such a case, but maybe optimistic locking could do the trick. Optimistic locking means: if the data has changed between the moment you fetched an object, and the moment you save it, than raise (and then you get the opportunity to ask the user/refresh the data/whatever). The last option would be pessimistic locking, which means that as long as an object lives in an EC, its db row remains locked. Pessimistic locking is a really strong requirement and I'm not going into this unless there is a real need. However optimistic locking is a natural expectation and this could be added sooner than (I!) expected if there is a real need for this (and even better, if you plan to experiment and test it in various ways). Last, as Soaf said, there are currently solutions involving using nested ECs, and/or locking special tables by hand for that purpose, but all these tricks are just what they are: tricks. But beware with sqlite, it's probably not mt-safe (gotta check however). > Grand Totals, Counters, etc. > Say I have a heavily accesed table and I want to have grand totals per > month. What is the best way to accomplish this? (The problem is that > if I do this within the domain class, it has to read and update the > total with added/updated/deleted data, but during these operations > other people may also hace to need to update the same field, causing > collisions or overwriting. If there was a 'add' operation which would > be translated to SQL (field=3Dfiel+increment), this problem would > disappear, as it would be executed inside a transaction. Also, the > grand total should perhaps be a volatile field and no cached, that is, > whenever we access entity.getGrandTotal() it would be read from the > database.) In databases with triggers, this is easily resolved inside > the DB, but we still need volatile attributes. That's a too long questions to answer now; I'll answer later, probably this evening. > Simple question: > can an editingContext access (fetch and update) classes of different > models at the same time? > (I think this is true, but still haven't tried it. It can also treat > heterogenous data sources, although there may be no relations between > different models, right?) Absolutely, as many models can be loaded at the same time, the only conditions is that two entities in the models cannot have the same name. Ok, I've got to go back to work now, I'll be back this evening. Regards, -- S=E9bastien. > Would it be possible to create a Wiki? Wouldn't it be the right place > to put questions like these? =20=20 |