ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rusty Wright <rusty.wri...@gmail.com>
Subject best way to use a Map?
Date Sat, 06 Oct 2007 05:25:43 GMT
I'm trying to figure out how to set up storing a Map of pairs of 
numbers.  I have a Photo object, and it has a Map of the different sizes 
in which the Photo is stored on disk.  The map keys are SIZE1, SIZE2, 
and SIZE3 (an enum; the map is an EnumMap).  The values in the Map are a 
simple object, ImageSize, with width and height fields. Each photo has 
its own sizes; no relationships and the widths and heights are 
essentially random values.

I'm thinking that in my database, each row for a Photo will have columns 
size1_width, size1_height, size2_width, size2_height, etc.  Doesn't 
sound too elegant but I can't see any other way.

I can't see any way to get these widths and heights into and out of the 
database other than to have getters and setters for each one. In order 
to not clutter my Photo class with those getters and setters I was 
thinking of making a PhotoDto data transfer object that does have the 
getters and setters and to wrap a Photo object in that before I send it 
off to iBatis.

Does this sound like a reasonable plan?

View raw message