Skip to content

Conversation

nPraml
Copy link
Contributor

@nPraml nPraml commented Jul 2, 2025

Hello @rbygrave ,

I've been trying to find a solution to the problem in #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 nPraml marked this pull request as draft July 2, 2025 06:40
for (BeanPropertyAssocOne<?> beanPropertyAssocOne : beanDescriptor.propertiesOne()) {
if(beanPropertyAssocOne.name().equals(path)) {
// only if we select the ID do we prevent the join, otherwise we need something from the other table anyway...
if(beanPropertyAssocOne.targetIdProperty().equals(properties)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this if branch does not work properly yet, you can also fetch other OnProperty, not just the id

@nPraml nPraml mentioned this pull request Jul 9, 2025
@nPraml
Copy link
Contributor Author

nPraml commented Jul 9, 2025

this PR can be closed if #3644 is found to be better

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant