Vadim Gritsenko wrote:

Not to prevent you from tinkering with this code, but a side comment about "hooking up an O/R mapping". I don't think I'd be totally off mark if I were to say that any respectable O/R mapping will make sure that:


* Any obj.get() will pull information from database only once during the life of the transaction, and only in case lazy loading is used

s/will/should/ , and only when configured to do so. It's hibernate i am using, for the moment it's setup not to do any caching at all. Note that at this point in my app i don't need to write anything back, so there are no transactions involved yet.


* Any set() won't write anything to database at all till some kind of obj.commit() or service.store(obj) is called
true.


Given these two points, it becomes less important how many times set/get is called. But it does not mean it should not be fixed :)
Well depends, i don't know (yet) what CForms does 12 times with the collection it retrieves. If it's a large collection and CForms is doing something else besides array reference assigning then it will become problematic in terms of performance.


PS Never worked with OJB / hibernate yet; how do they operate in such situation? IIRC, JDO operates exactly as described above.

It works quite well up until know. I have a huge datamodel to deal with, used middlegen to extract the O/R mapping from the database and generate the hibernate classes. It saved me heaps of time.



Jorg



Reply via email to