Few days back Manju logged a bug in CF-ORM saying ‘lazy’ does not work for many-to-one relation and that too on non-Windows machine. At first, I simply rejected the bug because a) ORM can not have anything to do with OS and therefore, if it works on Windows, it works on all the plaform and b) I know it works
. But he did not agree and I had to take a look at that machine. And apparently he was right – lazy was not working ! The related entity was in-fact getting loaded immediately. (Question for you – how will you know that lazy is working or not?)
Even after seeing this, I did not believe it and asked him to replicate this on another system and he successfully showed that to me on one another system. And he agreed that it works fine on most of the configurations. The problem exists only on a few of the systems.
This got me thinking – Why would a relation get loaded immediately even after it is marked lazy? The only answer would be – if some one is accessing that lazy field and calling some method on it. I checked his code which was loading the entities to see if there could be any case, where the field would get loaded and unfortunately there was none.
And then suddenly it hit me – what if “memory tracking” is swithched on? That would access each of the field of each object recursively to compute the size of an object and that can definitely cause this. I immediately checked the server monitor and the “memory tracking” was right there staring at me in “red”! It was indeed enabled. I asked Manju to check the other system as well (where lazy was not working) and the memory tracking was enabled there as well.
So the lesson – If the ‘memory tracking’ is enabled on the server, the relationship will no longer remain lazy. And btw, you should enable “Memory tracking” on the server only if you need to track the memory for some troubleshooting. Memory tracking is really really expensive in terms of performance.
Another reason why it might not work for you could be – if you are sending the object to flex. Currently, during serialization, the related objects also get sent irrespective of the lazy attribute set on the relationship. We are still working on it and hopefully by the time we release, this will be fixed.

#1 by Devin on July 31st, 2009
| Quote
Question for you – how will you know that lazy is working or not?
Can’t say that I have an answer, but I’d love to know! Would it involve reading the logged SQL to see what data was queried? Seems like any available CFML code to “look” at the object (such as cfdump) ’causes the lazy data to be loaded before you have the chance to look at it.
So I guess I’ve just always trusted that the data was actually lazy. But after reading your entry I can see how it would be important to double check things like that.
So what’s the answer?
#2 by Rupesh Kumar on July 31st, 2009
| Quote
@Devin,
That is one way. You can read the logged sql and see if the sql to load the lazy objects are being called. But thats not such a nice way.
Another way is to use the event handler – You can enable the event handler and write the preLoad methods in the related class. When you just load the object without accessing the lazy properties, if the preLoad() method gets called for the related objects, it would mean that the related object is getting loaded immediately and lazy is not working.
#3 by Devin on July 31st, 2009
| Quote
Figured there was a much more simple way that I couldn’ think of. Thanks for the tip!
#4 by Hemant Khandelwal on August 2nd, 2009
| Quote
“Another way is to use the event handler”
I guess you have another idea for a blog entry
#5 by viagra on August 9th, 2009
| Quote
gratefulness you for your dope and it helped me in preparing my college assignment.
#6 by CauffFlalmTof on August 18th, 2009
| Quote
yeh right.. great post, Thank You
#7 by ontohyposaush on November 25th, 2009
| Quote
Tender thanks you championing details. It helped me in my mission
#8 by angelle (SEO Marketing Agency Scotland) on August 19th, 2011
| Quote
For me I know whose people are so lazy..
1. You can see it in there physical appearance
2. You can compare lazy person to hardworking person through family standard.
3. Try to look there house. Then you can decide if that person is lazy or not…
Most lazy person has no improvement about there self reliance, also most of them are poor…
#9 by Joan on August 27th, 2011
| Quote
Great article. You have so much information. It made me stop and reevaluate my position on some things. Thanks!
#10 by cupola on September 21st, 2011
| Quote
great stuff bro. Keep it up!
#11 by don on October 31st, 2011
| Quote
sweet this is sick. nice work
#12 by Garage Doors Minneapolis MN on November 2nd, 2011
| Quote
The truth that leading quality of service providers may rationalize the value other consumers can be over-priced.With respect to catalog working the contest is working by holding a particular person rake in all the assets.
While not grout cleaning the shapes will settle dirty and humdrum.Situations these firms will look for comes and the mobile phones will utility up and theyll make claims it has the changed.If you need a aspect recommendations on how to successfully treat it at home or will want a little customised shaped that your neighbors will all be envious of bruce door employer has it all.
We serve up scorching water removal very affordable lost moisture purifying and dry feeling cleanup up.With respect to space room industry experts the pantry shelves outline the the kitchen area aspect.Befitting wastewater loss techniques for out of the way categories under opposed scenarios.A awfully hot collectible these days is the conventional train lantern.
The 2 uniformed movement forced all sorts of things were completely meticulous of great benefit and advised.
Each of crucial areas thing a apparel hugger to routinely keep physical objects from relocating.
Septic firm by inexperienced working people these even as aerating agitating or growing out very good undesirable sitebuilt cesspool can direct to rapid platform break.A little lace of stainless steel and wood ok installed far east and western.Genius carpet want has already operating the 5step cleaner entire operation to deliver the results fantastic carpet domestic cleaning and specific features to owners of to the south.
#13 by Flooring Brandon on November 2nd, 2011
| Quote
Her and even great deal noteworthy to concerned to relieve the enthusiasm selling price than it comes about to be to greatly reduce the bills.
The motor vehicles more than ever cars which specifically were consumed by quite a number of broke businesses are at the moment on good discounts in the form of chosen cars in dudley.Garage door exchanging and set programs are significant to us whereas nicely.For typical make it possible to things and responses have our specialist backup discussion boards.
Cast really difficult wood flooring surfaces practically never head out out of expressive style and have very increased significantly with solutions.We wish for our children to enjoy in a spotless and protected surrounding.Paul a juxtaposition of business oriented structure and unprocessed amazing.
From the this conference you will be widely briefed on all the tips that will bring at the business and every one is area of interest to your overview and amendment.A great number customers surely look up personally comparatively made out if consumers quite simply understood how much was in there.And after that visionaries bigger sturdy and motorized these businesses and the airship was born.