Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InternetEntityRepository#findUnauthorizedByUser and InternetEntityRepository#findIsAuthorizedByUser give unexpected query result #8

Open
c910335 opened this issue Jan 20, 2018 · 0 comments

Comments

@c910335
Copy link
Member

c910335 commented Jan 20, 2018

Their @Query should be something like these.

-- InternetEntityRepository#findUnauthorizedByUser
SELECT internet_entity.*, FALSE as authorized FROM internet_entity
LEFT JOIN entity_authorization on internet_entity.id = entity_authorization.entity_id AND entity_authorization.authorizee_id = :user_id
WHERE entity_authorization.authorizee_id IS NULL;
-- InternetEntityRepository#findIsAuthorizedByUser
SELECT internet_entity.*, entity_authorization.authorizee_id IS NOT NULL as authorized FROM internet_entity
LEFT JOIN entity_authorization on internet_entity.id = entity_authorization.entity_id AND entity_authorization.authorizee_id = :user_id;

However, I have no idea how to program with Spring flavored SQL(JPA?).

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

No branches or pull requests

1 participant