Long story short: one-to-one lazy loading does not appear to be working as expected.
My understanding of how lazy loading / proxy loading should work for one-to-one relationships is based on the adobe documention. I’ve also looked through this Lucee documentation, but it is pretty sparse.
I have entity A and entity B. These two entities have a one-to-one relationship. I define A’s relation to B like this:
property name="B" fieldType="one-to-one" cfc="B" fkColumn="foriegnKeyColumn" lazy="true";
The expected behavior is that I can now query data for entity A without pulling data for entity B. The observed behavior is that the corresponding data for entity B is getting queried every single time even if I don’t call the getter for B (this is true for
fetch="select"). I’ve tried querying the data using the built-in orm functions (i.e.
EntityLoad) and by using the hibernate criteria builder (via the ColdBox cborm module’s interface).
This is resulting in a whole lot of extra data being queried in scenarios where we don’t want the join data (and a TOOOON of queries where the relationship is defined with
Has anyone else experienced this? Am I doing something wrong? Is my understanding wrong? Are there any work arounds?