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

remove the raw sql query used to get skill requests for non-superusers #154

Open
yesyash opened this issue Aug 31, 2024 · 1 comment
Open
Assignees
Labels
enhancement Improving something existing

Comments

@yesyash
Copy link
Collaborator

yesyash commented Aug 31, 2024

requirement

  • remove the raw sql query in UserSkillRepository and use some feature from the ORM instead to query all skill requests created by non superusers
@yesyash yesyash converted this from a draft issue Aug 31, 2024
@yesyash yesyash self-assigned this Aug 31, 2024
@yesyash yesyash added the enhancement Improving something existing label Aug 31, 2024
@yesyash yesyash moved this to Todo in Skill tree Aug 31, 2024
@yesyash yesyash removed the status in Skill tree Aug 31, 2024
@iamitprakash
Copy link
Member

@PersistenceContext
private EntityManager entityManager;

CriteriaBuilder cb= entityManager.getCriteriaBuilder();
CriteriaQuery query= cb.createQuery(UserSkills.class);

        Root<UserSkills> userSkills = query.from(UserSkills.class);
        Join<UserSkills, Endorsement> endorsement= UserSkills.join("endorsements", JoinType.INNER);
        query.select(userSkills).where(cb.equal(endorsement.get("endorserId"), endorserId));

        skillRequests = entityManager.createQuery(query).getResultList();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving something existing
Projects
Status: No status
Development

No branches or pull requests

2 participants