|
Hi all,
I have a table with three columns.
Type
Code
Description
It's a look up table. So type +code make the primary key. I want to retrieve this data in a way that can be stored in hashmap. The key of map is type and value is list of objects . (The object is basically a bean with properties Code and Description)
The way I am doing it right now
1. get a list of all types then
2. Get the list of object based on each type
So if I have total 14 distinct types, I am making 15 queries to retrieve the data. Is that the right approach. Here is my mapping xml look like
DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<!-- This is designed keeping in mind the retrieve -->
<hibernate-mapping >
<class name="GenTable" table="GenTable">
<id name="type" type="string" column="GTType" >
<generator class="assigned"/>
</id>
<component name="entry" class="Entry">
<property name="code" >
<column name="CODE" />
</property>
<property name="desc" >
<column name="DESC" />
</property>
</component>
</class>
</hibernate-mapping>
TIA
Jas
Version 2.1.17
|