相关疑难解决方法(0)

hql 加入@CollectionTable

我有一个Service包含tags以下集合的域:

@Entity
public class Service extends AbstractEntity<Long> {
            private static final long serialVersionUID = 9116959642944725990L;

        @ElementCollection(fetch = FetchType.EAGER, targetClass = java.lang.String.class)
        @CollectionTable(name = "service_tags", joinColumns = @JoinColumn(name = "s_id"))
        @Column(name = "tag")
        private Set<String> tags;
    }
Run Code Online (Sandbox Code Playgroud)

我想选择Service小号with特定KEYService.tags

hql接合ServiceService.tags是如下:

select s from Service s INNER JOIN s.tags t where s.status=0 and (s.serviceType=9 or t.tag in ('College'))
Run Code Online (Sandbox Code Playgroud)

但是,上面的 hql 返回给我以下异常:

Caused by: java.lang.IllegalArgumentException: org.hibernate.QueryException: cannot …
Run Code Online (Sandbox Code Playgroud)

hibernate hql jpql

5
推荐指数
1
解决办法
3925
查看次数

标签 统计

hibernate ×1

hql ×1

jpql ×1