HQL select on embedded map

只谈情不闲聊 提交于 2019-12-05 08:01:59

I finally came up with the following solution (actually I am pretty sure it would also work using plan maps instead of the embeddable object)

@Entity
public class Category {
    ...
    @ElementCollection
    @CollectionTable(name = "locale_category_name", joinColumns=@JoinColumn(name="id"))
List<Localization> name;
    ...
}

@Embeddable
public class Localization {
    @NotNull
    public String locale;
    @NotNull
    public String label;
}

and the query (using join ... with ...)

from Category c join c.name l with (l.locale = :locale and lower(l.label) like :text)

Edit: Actually i was unable to get it to work with a Map, so I am using the @Embeddable solution after all

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!