How to find distinct rows with field in list using JPA and Spring?

前端 未结 5 1707
陌清茗
陌清茗 2020-12-01 17:45

I am using Spring to connect to the db. I have an interface extending CrudRepository Here is the query I want execute on the db: SELEC

5条回答
  •  悲哀的现实
    2020-12-01 18:28

    Have you tried rewording your query like this?

    @Query("SELECT DISTINCT p.name FROM People p WHERE p.name NOT IN ?1")
    List findNonReferencedNames(List names);
    

    Note, I'm assuming your entity class is named People, and not people.

提交回复
热议问题