commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Kjome <h...@visi.com>
Subject Re: [configuration] dbconfiguration
Date Fri, 21 Apr 2006 17:55:03 GMT

>> Object someValueAsObject = dbconfig.getProperty(someKeyAsString):

Borut,

Wouldn't you be treating the value that you get back from dbconfig as a String,
which is XStream-serialized XML, and then pass this into XStream to build it
back into an object again?  You're not suggesting that commons-configuration
should do this internally, are you?

Once you have the XML String from the config, just do, for instance...

String xml = dbconfig.getString(someKeyAsString):
Person savedPerson = (Person)xstream.fromXML(xml);


Jake

Quoting "Oliver.Heger@t-online.de" <Oliver.Heger@t-online.de>:

> I don't know the code in DatabaseConfiguration too well because I was
> not involved in this class. What problems do you have when you call
> other methods like getString(), getInt() etc.? Is an exception thrown?
>
> Oliver
>
> -----Original Message-----
> Date: Wed, 19 Apr 2006 20:30:37 +0200
> Subject: [configuration] dbconfiguration
> From: Borut Bol?ina
> To: Jakarta Commons Users List
>
> Hello,
>
> an experimental question I have. Suppose I use database to store
> configuration key and values. The database table has two columns:
>
> key = VARCHAR
> value = BLOB
>
> The value is XML serialized from POJO with XStream. I can easily write
> to databse with
>
>     dbconfig.setProperty(someKeyAsString, someValueAsString)
>
>
> How do I get someValueAsString back from database? It seems I can only
> use
>
>     Object someValueAsObject = dbconfig.getProperty(someKeyAsString):
>
>
> But I need String, Reader or InputStream to serialize someValue back to
> POJO.
>
>
> -Borut
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message