Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Migration to query dsl 4 #417

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

LiamClark
Copy link
Contributor

Querydsl moved to a new domain and has a new version out.

The main issue is that
.exists(); is gone in the newer version
The closest I could translate this is:
.fetchCount() > 0;

I opted for the fail fast FetchOne instead of FetchFirst, but this is debatable.

Further more map is no longer supported since they didn't like the usage of it and has become a group by.

.where(privateRepository.owner.netId.equalsIgnoreCase(username)
.and(privateRepository.title.equalsIgnoreCase(repositoryTitle)))
.singleResult(privateRepository),
.fetchOne(),
Copy link
Member

Choose a reason for hiding this comment

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

If fetchOne fails fast, then the ensureNotNull wrapper is unnecessary. But throughout Devhub we always propagate EntityNotFound exceptions, so if fetchOne throws something else, we should always catch and rethrow it, or may break other logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If there is no result it still returns null, leaving that logic valid, however it is stricter in the sense that for this query would there be two values, it throws a Not-unique exception.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 56.131% when pulling 561540b on LiamClark:query-dsl into b5c3e4c on devhub-tud:master.

@jwgmeligmeyling jwgmeligmeyling modified the milestone: 3.3.0 Apr 9, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants