> Hi all,
>
[quoted text clipped - 3 lines]
> there has to be a well-known approach to that problem - I just can't
> find it for the for the life of me :-)
Different data structures would get mapped differently.
> Can anybody help me out on that? Precisely I need to map a
> java.util.Hashtable to a HSQL database without using any specific OR
> library.
Store the keys somehow. Assume the keys have an ID.
Store the values somehow. Assume the values have an ID.
If you only need to store one Hashtable, you can create an SQL table to
represent that table with two columns. The first column is a reference to a
key id, and the second column is a reference to a value id. I.e. you're
storing a relationship between a key and a value.
If you need to store multiple hashtables, add a third column which is
the ID of the hashtable to which the relationship belongs.
- Oliver
Philipp Leitner - 13 Jul 2006 08:17 GMT
> Store the keys somehow. Assume the keys have an ID.
> Store the values somehow. Assume the values have an ID.
[quoted text clipped - 3 lines]
> key id, and the second column is a reference to a value id. I.e. you're
> storing a relationship between a key and a value.
arg ... I knew there had to be a simple way that I just didn't see. You
opened my eyes there - thanks a lot Oliver.
/philipp