I would like to persist a class A, containing a HashMap m, containing strings. The use case is a really simple contsruction:
Code:
public class A {
Map m = new HashMap();
Long id;
...
  public  string getStrForMapId (Integer key) {
    return (String) m.get (key);
  }
  public static A[] findAcontatingStr (string str) {
     //query the DB
  }
}
If I try to persist it exactly this way, the mapping itself is fine: hibernate creates 
two tables. But the problem is findAcontatingStr  method, as map's elements are not available in HQL, i.e. I can't do something like
Code:
"select A from A where A.m.elements() = :str" 
And if I created a composite-element class containg just a string, the HQL query would be possible, but Hibernate would create 
three  tables instead of 2. This workaround looks to me really ugly, as I have to produce one unnecessary class, and one unnecessary table.
Do I miss the proper way of solving this use case with Hibernate?