These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Retrieve Lookup Table
PostPosted: Wed Apr 13, 2005 3:01 pm 
Newbie

Joined: Wed Apr 13, 2005 2:59 pm
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.