-->
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: mapping multiple rows of a table to one instance of class???
PostPosted: Tue Jul 01, 2008 12:16 pm 
Newbie

Joined: Tue May 13, 2008 10:01 am
Posts: 8
Hibernate version:
Current latest


Assume the following table schema
(col1, col2, col3), where we can assume the primary key as a composite key of all three columns.
Sample rows/values:
(MMSA_001, STX1, 105),
(MMSA_002, STX1, 105),
(MMSA_003, STX1, 105),
(MMSA_004, STX1, 105),
(CCSA, STXB, 33),
(IRA_SH_ESA_SA, STX1, 101),
(IRA_SH_ESA_SA, STX1, 102),
(CT_1K_MIN_001, STXB, 1),
(CT_1K_MIN_001, STXB, 11),
(CT_1K_MIN_001, STXB, 24)

So on...


The class we have is:
Code:
class  Sample {
String productId;
HashMap screenPointerMap;
}

According to the last 3 rows (that are colored red), after mapping, we would like to have an instance of the above class Sample, with the following values.

CT_1K_MIN_001 for the productId property
and the screenPointerMap property will contain one element that will hold the key as STXB and the value of the map will be a list storing the integers 1, 11, 24.

Basically, based on the column relationships, mapping 3 rows to one instance of one class.

Is this possible as it is with the existing table schema...?

Any alternative suggestions also will be greatly helpful.

Thanks all.

_________________
Best wishes


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.