-->
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 columns to a Map
PostPosted: Tue Aug 05, 2008 4:45 am 
Newbie

Joined: Tue Aug 05, 2008 4:31 am
Posts: 3
Hello, I'm trying to do this with Hibernate but I don't know how.

I have a table like this:

Code:
REPARTO (
   ID_ARTICLE BIGINT,
   SIZE1          VARCHAR,
   REP1           INTEGER,
   SIZE2          VARCHAR,
   REP2           INTEGER,
   SIZE3          VARCHAR,
   REP3           INTEGER,
   SIZE4          VARCHAR,
   REP4           INTEGER,
   SIZE5          VARCHAR,
   REP6           INTEGER,
)


And I would like to map it to a class like this:

Code:
public class Reparto {
    private Long idArticle;
    private Map<String, Integer> sizes;

    // getter and setter, etc...
}


The map sizes should contain the five sizes (SIZE1, SIZE2...) as key, and the repetitions (REP1, REP2...) of each size as value, i.e. ["S"->2, "M"->4, "L"->5, "XL"->7, "XXL"->6]

But I don't know how to make the mapping with Hibernate for get this, can you help me? please.

Many thanks in advance and sorry for my poor english.


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.