I have a text array and crud operations are working well. Now, I would like to find a list of string using a native query. I've tried the following solution
@Query(nativeQuery = true, value= "select * from biz_db.biz_user where :skills=ANY(skills) and " +
"expert=1 and enabled=1 and " +
"verified=1 order by creation_date desc limit 3")
List<User> findAllExpertsBySkills(@Param("skills") String[] skills);
Which I get
Caused by: org.hibernate.QueryException: Named parameter not bound : skills
Any help appreciated.
here is the skills in User class
@Type( type = "string-array" )
@Column(
name = "skills",
columnDefinition = "text[]"
)
private String[] skills;
And in the table is defined
skills text[] NULL,
:skillsseems to be an array. So you are trying to doarray = ANY(array). This is not supported. Maybe you could try the && operator::skills && skills. This operator gives true, if both arrays overlap (share at least one element):skillsis of type bytea. I am not too deep into Hibernate but it seems that Hibernate does not support array types. Maybe this helps? vladmihalcea.com/…skillscontains binary data (which is whatbyteameans), then why would you search for text strings in that column?