Tuesday, April 23, 2013

How to query on key of map collection in Hibernate?


Until Hibernate implements JPA's key() function (see HHH-5396), you can use the index() function:
Query q = session.createQuery("select a from TestA a join a.testBMap m where index(m) = :key");
q.setParameter("key", "test1");
q.list();

No comments:

Google+