| Author |
Getting Enities in hashmap
|
smitha eliz joshi
Greenhorn
Joined: Aug 30, 2012
Posts: 6
|
|
hi,
I am new to Hibernate and my query is retrieving entities.
Entity has simple string properties.
one of the property is key (id). I need these entities as detached & need to do read only.
I am thinking to put these entities in hashmap & using id property as key in hashmap.
I am thinking to do it in Java (iterate collection of entities & save in hashmap).
I believe this is not correct way & there would be way to get the retrieved collection in hashmap directly.
Can you please suggest key-word to google I should look for to read on this OR any link/example to this case ?
regards.
|
 |
lokesh sree
Ranch Hand
Joined: Oct 27, 2009
Posts: 88
|
|
"Iterating over the entities and saving them into the required HashMap or whatever collection". This seems to be fine and I don't see anything wrong with this approach.
Though I have not tried, the following links to seems to talk about returning a map from the queries...
http://stackoverflow.com/questions/3292597/how-to-get-java-util-map-from-hibernate-query
http://stackoverflow.com/questions/925363/how-to-fetch-hibernate-query-result-as-associative-array-of-list-or-hashmap
Hope that helps..
|
Lokesh
( SCBCD 5, CCENT, SCJP 5 )
|
 |
smitha eliz joshi
Greenhorn
Joined: Aug 30, 2012
Posts: 6
|
|
thanks for your reply...
|
 |
 |
|
|
subject: Getting Enities in hashmap
|
|
|