Design patterns·Wrapping and composing
you had an object with an id and nothing else, and touching any other property fired a query.
Virtual proxy
Also calledlazy proxy, loading proxy
A proxy that stands in for an expensive object and creates or loads it on first real use. It is the mechanism behind ORM lazy loading and behind placeholder objects in graphics and document systems. Its characteristic problem is that the cost is invisible at the call site, which is precisely how the N+1 query gets written by someone who thought they were reading a field.