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.