out-of-the-box way to get an idmap from hibernate for a given entity?

Posted by Geert-Jan on Stack Overflow See other posts from Stack Overflow or by Geert-Jan
Published on 2010-05-21T18:40:19Z Indexed on 2010/05/21 18:40 UTC
Read the original article Hit count: 130

Filed under:
|

Over and over again I notive myself getting a list from hibernate, and the first thing next is put it in an idmap

like:

List<House> entities = s.createCriteria(House.class).list();
Map<String,House> entitymap  = new HashMap<String,House>();
for(TA_entity e:entities){
  entitymap.put(e.getId(), e);
}

Is there a way to get this directly out of hibenerate? afterall Hibernate is familiar with the id.

© Stack Overflow or respective owner

Related posts about java

Related posts about hibernate