diff --git a/server/src/main/java/com/objectcomputing/checkins/services/certification/CertificationRepository.java b/server/src/main/java/com/objectcomputing/checkins/services/certification/CertificationRepository.java index 2e9afea7fb..ab8fa38f88 100644 --- a/server/src/main/java/com/objectcomputing/checkins/services/certification/CertificationRepository.java +++ b/server/src/main/java/com/objectcomputing/checkins/services/certification/CertificationRepository.java @@ -14,9 +14,9 @@ public interface CertificationRepository extends CrudRepository getByName(String name); - @Query(""" + @Query(value = """ SELECT * FROM certification WHERE is_active = TRUE OR :includeDeactivated = TRUE - ORDER BY name""") + ORDER BY name""", nativeQuery = true) List findAllOrderByNameAsc(boolean includeDeactivated); } diff --git a/server/src/main/java/com/objectcomputing/checkins/services/certification/EarnedCertificationRepository.java b/server/src/main/java/com/objectcomputing/checkins/services/certification/EarnedCertificationRepository.java index cefa5ccb97..4bb29c716e 100644 --- a/server/src/main/java/com/objectcomputing/checkins/services/certification/EarnedCertificationRepository.java +++ b/server/src/main/java/com/objectcomputing/checkins/services/certification/EarnedCertificationRepository.java @@ -14,39 +14,39 @@ public interface EarnedCertificationRepository extends CrudRepository findByCertificationId(@NotNull UUID certificationId); - @Query(""" + @Query(value = """ SELECT earned.* FROM earned_certification AS earned LEFT JOIN certification AS cert USING(certification_id) WHERE cert.is_active = TRUE OR :includeDeactivated = TRUE - ORDER BY earned.earned_date DESC, earned.description""") + ORDER BY earned.earned_date DESC, earned.description""", nativeQuery = true) List findAllOrderByEarnedDateDesc(boolean includeDeactivated); - @Query(""" + @Query(value = """ SELECT earned.* FROM earned_certification AS earned LEFT JOIN certification AS cert USING(certification_id) WHERE earned.certification_id = :certificationId AND (cert.is_active = TRUE OR :includeDeactivated = TRUE) - ORDER BY earned.earned_date DESC, earned.description""") + ORDER BY earned.earned_date DESC, earned.description""", nativeQuery = true) List findByCertificationIdOrderByEarnedDateDesc(@NotNull UUID certificationId, boolean includeDeactivated); - @Query(""" + @Query(value = """ SELECT earned.* FROM earned_certification AS earned LEFT JOIN certification AS cert USING(certification_id) WHERE earned.member_id = :memberId AND (cert.is_active = TRUE OR :includeDeactivated = TRUE) - ORDER BY earned.earned_date DESC, earned.description""") + ORDER BY earned.earned_date DESC, earned.description""", nativeQuery = true) List findByMemberIdOrderByEarnedDateDesc(@NotNull UUID memberId, boolean includeDeactivated); - @Query(""" + @Query(value = """ SELECT earned.* FROM earned_certification AS earned LEFT JOIN certification AS cert USING(certification_id) WHERE earned.certification_id = :certificationId AND earned.member_id = :memberId AND (cert.is_active = TRUE OR :includeDeactivated = TRUE) - ORDER BY earned.earned_date DESC, earned.description""") + ORDER BY earned.earned_date DESC, earned.description""", nativeQuery = true) List findByMemberIdAndCertificationIdOrderByEarnedDateDesc(@NotNull UUID memberId, @NotNull UUID certificationId, boolean includeDeactivated); } diff --git a/server/src/main/java/com/objectcomputing/checkins/services/volunteering/VolunteeringEventRepository.java b/server/src/main/java/com/objectcomputing/checkins/services/volunteering/VolunteeringEventRepository.java index 40967551aa..c453da9051 100644 --- a/server/src/main/java/com/objectcomputing/checkins/services/volunteering/VolunteeringEventRepository.java +++ b/server/src/main/java/com/objectcomputing/checkins/services/volunteering/VolunteeringEventRepository.java @@ -12,7 +12,7 @@ @JdbcRepository(dialect = Dialect.POSTGRES) public interface VolunteeringEventRepository extends CrudRepository { - @Query(""" + @Query(value = """ SELECT event.* FROM volunteering_event AS event JOIN volunteering_relationship AS rel USING(relationship_id) @@ -20,10 +20,10 @@ JOIN volunteering_organization AS org USING(organization_id) WHERE rel.member_id::uuid = :memberId AND (rel.is_active = TRUE OR :includeDeactivated = TRUE) AND (org.is_active = TRUE OR :includeDeactivated = TRUE) - ORDER BY event.event_date, org.name, event.hours DESC""") + ORDER BY event.event_date, org.name, event.hours DESC""", nativeQuery = true) List findByMemberId(@NotNull UUID memberId, boolean includeDeactivated); - @Query(""" + @Query(value = """ SELECT event.* FROM volunteering_event AS event JOIN volunteering_relationship AS rel USING(relationship_id) @@ -31,10 +31,10 @@ JOIN volunteering_organization AS org USING(organization_id) WHERE org.organization_id::uuid = :organizationId AND (rel.is_active = TRUE OR :includeDeactivated = TRUE) AND (org.is_active = TRUE OR :includeDeactivated = TRUE) - ORDER BY event.event_date, org.name, event.hours DESC""") + ORDER BY event.event_date, org.name, event.hours DESC""", nativeQuery = true) List findByOrganizationId(@NotNull UUID organizationId, boolean includeDeactivated); - @Query(""" + @Query(value = """ SELECT event.* FROM volunteering_event AS event JOIN volunteering_relationship AS rel USING(relationship_id) @@ -43,16 +43,16 @@ JOIN volunteering_organization AS org USING(organization_id) AND org.organization_id::uuid = :organizationId AND (rel.is_active = TRUE OR :includeDeactivated = TRUE) AND (org.is_active = TRUE OR :includeDeactivated = TRUE) - ORDER BY event.event_date, org.name, event.hours DESC""") + ORDER BY event.event_date, org.name, event.hours DESC""", nativeQuery = true) List findByMemberIdAndOrganizationId(@NotNull UUID memberId, @NotNull UUID organizationId, boolean includeDeactivated); - @Query(""" + @Query(value = """ SELECT event.* FROM volunteering_event AS event JOIN volunteering_relationship AS rel USING(relationship_id) JOIN volunteering_organization AS org USING(organization_id) WHERE (rel.is_active = TRUE OR :includeDeactivated = TRUE) AND (org.is_active = TRUE OR :includeDeactivated = TRUE) - ORDER BY event.event_date, org.name, event.hours DESC""") + ORDER BY event.event_date, org.name, event.hours DESC""", nativeQuery = true) List findAll(boolean includeDeactivated); } diff --git a/server/src/main/java/com/objectcomputing/checkins/services/volunteering/VolunteeringOrganizationRepository.java b/server/src/main/java/com/objectcomputing/checkins/services/volunteering/VolunteeringOrganizationRepository.java index d44c96d1f9..cbbbea279d 100644 --- a/server/src/main/java/com/objectcomputing/checkins/services/volunteering/VolunteeringOrganizationRepository.java +++ b/server/src/main/java/com/objectcomputing/checkins/services/volunteering/VolunteeringOrganizationRepository.java @@ -14,10 +14,10 @@ public interface VolunteeringOrganizationRepository extends CrudRepository getByName(String name); - @Query(""" - SELECT org.* - FROM volunteering_organization AS org - WHERE org.is_active = TRUE OR :includeDeactivated = TRUE - ORDER BY org.name""") + @Query(value = """ + SELECT org.* + FROM volunteering_organization AS org + WHERE org.is_active = TRUE OR :includeDeactivated = TRUE + ORDER BY org.name""", nativeQuery = true) List findAll(boolean includeDeactivated); } \ No newline at end of file diff --git a/server/src/main/java/com/objectcomputing/checkins/services/volunteering/VolunteeringRelationshipRepository.java b/server/src/main/java/com/objectcomputing/checkins/services/volunteering/VolunteeringRelationshipRepository.java index b980feb1f3..a89845bbda 100644 --- a/server/src/main/java/com/objectcomputing/checkins/services/volunteering/VolunteeringRelationshipRepository.java +++ b/server/src/main/java/com/objectcomputing/checkins/services/volunteering/VolunteeringRelationshipRepository.java @@ -13,7 +13,7 @@ @JdbcRepository(dialect = Dialect.POSTGRES) public interface VolunteeringRelationshipRepository extends CrudRepository { - @Query(""" + @Query(value = """ SELECT rel.* FROM volunteering_relationship AS rel JOIN volunteering_organization AS org USING(organization_id) @@ -21,43 +21,43 @@ JOIN volunteering_organization AS org USING(organization_id) AND rel.member_id = :memberId AND (rel.is_active = TRUE OR :includeDeactivated = TRUE) AND (org.is_active = TRUE OR :includeDeactivated = TRUE) - ORDER BY rel.start_date, org.name""") + ORDER BY rel.start_date, org.name""", nativeQuery = true) List findByMemberIdAndOrganizationId(UUID memberId, UUID organizationId, boolean includeDeactivated); - @Query(""" + @Query(value = """ SELECT rel.* FROM volunteering_relationship AS rel JOIN volunteering_organization AS org USING(organization_id) WHERE rel.member_id = :memberId AND (rel.is_active = TRUE OR :includeDeactivated = TRUE) AND (org.is_active = TRUE OR :includeDeactivated = TRUE) - ORDER BY rel.start_date, org.name""") + ORDER BY rel.start_date, org.name""", nativeQuery = true) List findByMemberId(UUID memberId, boolean includeDeactivated); - @Query(""" + @Query(value = """ SELECT rel.* FROM volunteering_relationship AS rel JOIN volunteering_organization AS org USING(organization_id) WHERE rel.organization_id = :organizationId AND (rel.is_active = TRUE OR :includeDeactivated = TRUE) AND (org.is_active = TRUE OR :includeDeactivated = TRUE) - ORDER BY rel.start_date, org.name""") + ORDER BY rel.start_date, org.name""", nativeQuery = true) List findByOrganizationId(UUID organizationId, boolean includeDeactivated); - @Query(""" + @Query(value = """ SELECT rel.* FROM volunteering_relationship AS rel JOIN volunteering_organization AS org USING(organization_id) WHERE (rel.is_active = TRUE OR :includeDeactivated = TRUE) AND (org.is_active = TRUE OR :includeDeactivated = TRUE) - ORDER BY rel.start_date, org.name""") + ORDER BY rel.start_date, org.name""", nativeQuery = true) List findAll(boolean includeDeactivated); - @Query(""" + @Query(value = """ SELECT rel.* FROM volunteering_event AS event JOIN volunteering_relationship AS rel USING(relationship_id) - WHERE event.event_id::uuid = :eventId""") + WHERE event.event_id::uuid = :eventId""", nativeQuery = true) Optional getRelationshipForEvent(@Nullable UUID eventId); Optional findById(@Nullable UUID eventId);