I'm having problems on querying some entity that matches some criteria (key/value - coming from the web) with it's HashMap.
The entity looks like this:
@Entity
class Entity {
@ElementCollection
@MapKeyColumn(name = "context_key")
@Column(name = "context_value")
@CollectionTable(name = "entity_context_data", joinColumns = @JoinColumn(name = "entity_id"))
private Map<String, String> contextData = new HashMap<>();
}
I'm trying to query the Entity using Criteria:
Criteria criteria = getSession().createCriteria(Entity.class, "entity")
for (Entry<String, String> entry : keyValuesFromWeb.entrySet()) {
criteria.add(in(entry.getKey(), Arrays.asList(entry.getValue())));
}
But this clearly doesn't work. According to https://hibernate.atlassian.net/browse/HHH-6103 it should be solved. Anybody who got this working?