ebean icon indicating copy to clipboard operation
ebean copied to clipboard

Draft: Fetch id only - v1

Open nPraml opened this issue 6 months ago • 1 comments

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 OrmQueryDetail in 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?

nPraml avatar Jul 02 '25 06:07 nPraml

this PR can be closed if https://github.com/ebean-orm/ebean/pull/3644 is found to be better

nPraml avatar Jul 09 '25 08:07 nPraml