Skip to content Skip to sidebar Skip to footer

Like Query On Values Of Map Elementcollection In Entity In Hql

I have an entity named « Form » that contains a Map « details » of (key/value)=(language code/translation) : @Entity class Form { : @ElementCollection(fetch = FetchType.EA

Solution 1:

In SQL, % is a wildcard used in the LIKE operator. Your query would be something like:

@Query("SELECT f FROM Form f JOIN f.details d 
WHERE KEY(d) = :language 
AND VALUE(d) LIKE '%' + :search + '%'")

If this doesn't work, you might have to append % to the beginning and end of you variable :search

Post a Comment for "Like Query On Values Of Map Elementcollection In Entity In Hql"