mcorleone wrote:
I was thinking, maybe i should store it in a Byte array
If database portability is a concern, be careful with array data types. Some databases don't support array-valued columns. Maybe something like
One idea (not saying it's necessarily a good one, though ;) ):
Code:
ARRAY_ID INTEGER
ARRAY_INDEX INTEGER
ARRAY_COLS INTEGER
VALUE BOOLEAN (or CHAR, or BYTE?)
Since a multidimensional array can be expressed as a one dimensional array, you could do this, and then store the number of columns per row. The schema above isn't quite normalized, since ARRAY_COLS would be repeated a lot, but I'm not sure you'd want to do a separate table.
The mapping here would be... fun, but perhaps not too bad... I'm thinking it would be an indexed list. You could expose your array through a getter (unmapped) that creates it from the list, although it would probably have to have a setter to get changes to the array back in... changing the exposed array directly probably couldn't be transitively persisted. Needless to say, this wouldn't really be mapping the array, but rather mapping a representation of the array to a class that can create a copy of the array for you.
The other option, as was mentioned, of course, would be some type of UserType. I've never done one (as of yet), though, so I don't know how hard/easy it would be.