question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fetchJoin(JoinFlag) cancelling

See original GitHub issue

fetchJoin is useful for traversing entity-graph. But, when projectioning is required, we could not use it.

When projectioning(e.g. min/max/count) is required, I wanna instantiate a original JPAQuery and then query fetchJoin-canceled JPAQuery. For example(in Kotlin):

val q = from(foo).innerJoin(bar).fetchJoin().where(...).orderBy(...)

val maxId = q.select(foo.id.max()).removeFlag(FETCH).fetchOne()

val result = q.where(foo.id.lt(maxId)).fetch()

DefaultQueryMetadata has addJoinFlag(...) but no removeJoinFlag(...). It would be great to have it!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
devckencommented, Sep 18, 2020

@jwgmeligmeyling Thank you for your help! In my case, your last help is best!

1reaction
jwgmeligmeylingcommented, Sep 18, 2020

Mind that you can also just remove all FETCH flags: query.getMetadata().getJoins().forEach(join -> join.getFlags().remove(FETCH))

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found