Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/379.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java JPA Hibernate在@ElementCollection上选择distinct并比较_Java_Spring_Hibernate_Jpa - Fatal编程技术网

Java JPA Hibernate在@ElementCollection上选择distinct并比较

Java JPA Hibernate在@ElementCollection上选择distinct并比较,java,spring,hibernate,jpa,Java,Spring,Hibernate,Jpa,我正在将Hibernate与JpaRepositories一起使用 实体类的相关部分为: @Entity public class Person { //.. id and other attributes @Column(name = "function") @ElementCollection private Set<String> functions; // .. getter setter } 如何使用新的@Element

我正在将Hibernate与JpaRepositories一起使用

实体类的相关部分为:

@Entity
public class Person {
   //.. id and other attributes

   @Column(name = "function")
   @ElementCollection
   private Set<String> functions;

  // .. getter setter
}

如何使用新的@ElementCollection存档相同的结果?

您需要将集合加入到
Person
中,然后选择。请尝试以下查询:

select DISTINCT(f) from Person p join p.functions f where UPPER(f) like UPPER(:term) order by f
select DISTINCT(f) from Person p join p.functions f where UPPER(f) like UPPER(:term) order by f