Hi Andrus,
I would go with your last suggestion. I don't know why I was thinkging about complex solution. Any ways Thanks,
Denna
Andrus Adamchik <andru..bjectstyle.org> wrote:
On Jun 16, 2005, at 3:16 PM, Dhruti Ramani wrote:
> Hi,
>
> I would like to persist a hashtable that will map strings to
> Booleans("option1",new Boolean(true)). Is there a way to do this in
> cayenne? Or is there any other way to store key and value ?
> Database that I am using is postgresql.
>
> Thanks,
>
> Denna
Denna,
If you don't need to query on individual keys, you can serialize the
whole hashtable as a CLOB field. You can use java.util.Properties
class (or any of the open source enhancements of it), but if you know
that all your fields are always boolean, you can create a much
simpler custom serialization scheme. E.g. store key/value pairs as a
delimited string ( key1=1;key2=0;key3=0... etc..)
Or you can define two tables - one to store each hashtable (really
just an id), and another one to store its key/value pairs. table1
will have a one-to-many relationship to table2.
Andrus
---------------------------------
Yahoo! Sports
Rekindle the Rivalries. Sign up for Fantasy Football
This archive was generated by hypermail 2.0.0 : Fri Jun 17 2005 - 17:42:30 EDT