第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Spring Boot - Jpa 獨特且可分頁

Spring Boot - Jpa 獨特且可分頁

慕碼人2483693 2023-08-04 19:07:35
我有一個使用 kotlin 的 Spring Boot v 2.1.8.RELEASE 項目。我們使用 postgres 數(shù)據(jù)庫,我有以下 JPA 查詢    @Query(value = " SELECT distinct grievance " +               " FROM Grievance grievance" +               " WHERE (grievance.auditProgramPortal=:auditProgramPortal AND grievance.owner.id=:organizationId) " +               " OR (grievance.status=:status AND grievance.auditProgramPortal=:auditProgramPortal)" +               " OR (grievance.auditProgramPortal=:auditProgramPortal AND grievance.owner.id=:organizationId)" +               " OR (grievance.auditProgramPortal=:auditProgramPortal AND grievance.publicSubmission=:publicSubmission)")fun findAnalystBodyGrievances(        auditProgramPortal: Boolean,        organizationId: Long,        status: GrievanceStatus,        publicSubmission: Boolean,        pageable: Pageable): Page<Grievance>當我按原樣運行它時 - 它工作得很好。當我對行業(yè)字段進行排序時(參見下面的對象) - 我收到以下錯誤org.postgresql.util.PSQLException: ERROR: for SELECT DISTINCT, ORDER BY expressions must appear in select list相關對象的片段如下申訴@Entity@Audited@Table(name = "grievance")class Grievance {    @Id    @GeneratedValue(strategy = GenerationType.IDENTITY)    @Column(name = "id")    var id: Long? = null    @Column(name = "title", nullable = false)    var title: String? = null    @Column(name = "description", columnDefinition = "text")    var description: String? = null    @Column(name = "public_description", columnDefinition = "text")    var publicDescription: String? = null    @Column(name = "related_to_identified_risk")    var relatedToIdentifiedRisk: Boolean? = null    @OneToOne    @JoinColumn(name = "industry_id")    var industry: Industry? = null  }行業(yè)@Entity@Table(name = "industry")class Industry {    @Id    @GeneratedValue(strategy = GenerationType.IDENTITY)    @Column(name = "id")    var id: Long? = null    @Column(name = "name", nullable = false, unique = true)    var name: String? = null    @Column(name = "color", nullable = false, unique = false)    var color: String? = null}
查看完整描述

1 回答

?
狐的傳說

TA貢獻1804條經(jīng)驗 獲得超3個贊

嘗試下面


@Query(value =" Select grievance from (SELECT distinct grievance, grievance.industry " +

" FROM Grievance grievance" +

" WHERE (grievance.auditProgramPortal=:auditProgramPortal AND grievance.owner.id=:organizationId) " +

" OR (grievance.status=:status AND grievance.auditProgramPortal=:auditProgramPortal)" +

" OR (grievance.auditProgramPortal=:auditProgramPortal AND grievance.owner.id=:organizationId)" +

" OR (grievance.auditProgramPortal=:auditProgramPortal AND grievance.publicSubmission=:publicSubmission))")



查看完整回答
反對 回復 2023-08-04
  • 1 回答
  • 0 關注
  • 138 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號