Yes, you're right, but what do you think about Hibernate witch seems to do
this very simply ?

Eric

-----Message d'origine-----
De : Thomas Dudziak [mailto:[EMAIL PROTECTED]
Envoye : lundi 24 novembre 2003 11:01
A : OJB Users List
Objet : RE: Collection of string




On Mon, 24 Nov 2003, eric barbe wrote:

> Hi Thomas,
>
> Thanks for your help.
> I thought about this solution, but honestly, it is not very beautiful.
> They are no other ways ?
> Is it possible to hope that OJB will do this easily in a future release ?

Thats not so much a problem of OJB but a design decision of Java. Strings
are immutable after creation (value objects). OJB can work with all
objects that are changeable after creation and have a default constructor.
Actually, that is not quite correct. It seems that in the current CVS
version you can define a factory class and method to create objects so
there is no need for the default constructor anymore. So in theory, you
might be able to use strings after all, using a combination of
factory-class/method and a custom row-reader for the string objects
(I'm not an expert of row-readers so this might be wrong). But this is
probably not quite an elegant solution.

As for the "beauty" of the solution, that depends on your application, or
more precisely, on how the strings are used. If there is functionality
that can be put into the wrapper objects (say, conversion from exceptions,
serialization to/from XML etc.) then they can actually make the design of
your system more beautiful.

Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to