Draft: Fetch id only - v1
Hello @rbygrave ,
I've been trying to find a solution to the problem in https://github.com/ebean-orm/ebean/pull/3644.
I see two ways to approach the problem:
- either recognize when calling fetch that you only need the ID of the OneProperties and convert it immediately to a select (in
OrmQueryDetailin the select clause instead of fetchPath) - or recognize later, when assembling the
SqlTree, when a join would be unnecessary.
I've programmed a sketch of the initial idea, which only shows roughly what I envision for the solution. I only provisionally built the extension of the selects in OrmQueryDetail and OrmQueryProperties because we would then need such a mechanism; it's probably not 100% correctly implemented.
I've disabled one test, which I can look at later. In the subsequent tests, the queries have become simpler.
Can you please take a look at this PR to see if it's moving in the right direction? Or should we pursue the second idea that the simplification only happens later in the SqlTree?
this PR can be closed if https://github.com/ebean-orm/ebean/pull/3644 is found to be better