Skip to content

Commit

Permalink
update queries to fix failing test against h2 db
Browse files Browse the repository at this point in the history
  • Loading branch information
achimber-moj committed Dec 11, 2024
1 parent 526bf92 commit 410ba1f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package uk.gov.justice.digital.hmpps.integrations.delius.overview.entity

import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.Id
import jakarta.persistence.Table
import jakarta.persistence.*
import org.hibernate.annotations.Immutable
import org.hibernate.annotations.SQLRestriction
import org.hibernate.type.NumericBooleanConverter
import org.springframework.data.jpa.repository.JpaRepository

@Immutable
Expand All @@ -26,6 +24,8 @@ class Alias(
val thirdName: String? = null,
@Column(name = "surname", length = 35)
val surname: String,
@Column(name = "soft_deleted", columnDefinition = "number")
@Convert(converter = NumericBooleanConverter::class)
val softDeleted: Boolean = false
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,10 +405,10 @@ interface CaseloadRepository : JpaRepository<Caseload, Long> {
left join fetch d.type dt
where c.staff.id = :id
and (:nameOrCrn is null
or upper(p.crn) like '%' || upper(:nameOrCrn) || '%'
or upper(p.forename || ' ' || p.surname) like '%' || upper(:nameOrCrn) || '%'
or upper(p.surname || ' ' || p.forename) like '%' || upper(:nameOrCrn) || '%'
or upper(p.surname || ', ' || p.forename) like '%' || upper(:nameOrCrn) || '%')
or upper(p.crn) like '%' || upper(:nameOrCrn) || '%' ESCAPE '\'
or upper(p.forename || ' ' || p.surname) like '%' || upper(:nameOrCrn) || '%' ESCAPE '\'
or upper(p.surname || ' ' || p.forename) like '%' || upper(:nameOrCrn) || '%' ESCAPE '\'
or upper(p.surname || ', ' || p.forename) like '%' || upper(:nameOrCrn) || '%' ESCAPE '\')
and (:nextContactCode is null or (upper(trim(naType.code)) = upper(trim(:nextContactCode))))
and (:sentenceCode is null or (upper(trim(dt.code)) = upper(trim(:sentenceCode))))
"""
Expand Down

0 comments on commit 410ba1f

Please sign in to comment.