How to create Map from Hibernate query list -


i have requirement create map hibernate query result. here need

the query returns list of users. have create map list. map key dept id , map value list of users department.

criteria criteria=session.createcriteria(user.class).list

this return list[user1, user2,...]

i want create map list

map< dept1:[user1,user2,user3,..],     dept2:[user1,user2,user3,..],     ..     ..    > 

is there easy way this.

you can using map collection feature of hibernate. but, may have query each department(sort of loop) , add final map.

check map section in document .


Comments

Popular posts from this blog

How to access named pipes using JavaScript in Firefox add-on? -

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -

node.js - req param returns an empty array -