EntityLoadByPK - undocumented cf9 method
July 23, 2009
I was reading Rupesh Kumar post ColdFusion ORM : The basics where he'd posted this example:
artist = EntityLoadByPK("Artists", 1);
I hadn't seen the EntityLoadByPK method before, so I went off to check the docs and couldn't find it. As Rupesh is a member of the ColdFusion engineering team I asked him if:
artist = EntityLoadByPK("Artists", 1);
was the same as:
artist = EntityLoad("Artists", 1, True);
Sure enough, it is exactly the same. Whether this method becomes a documented feature or not I don't know but I quite like it as a shortcut. In case you're wondering, then the "true" argument, means that the EntityLoad method should return an object. If you omit it you will get an array of Artists objects. So you could even write the code like this if you wanted.
artist = EntityLoad("Artists", 1)[1];
Hats off to Rupesh and the rest of the Engineering team for the fantastic job they have done of integrating Hibernate into ColdFusion.
- Posted in:
- ColdFusion
- OOP
No comments
Leave a comment
If you found this post useful, interesting or just plain wrong, let me know - I like feedback :)




