Jeromy Evans on 19/02/08 22:23, wrote:
Daniel Baldes wrote:
Hello,
I have a web form where you can, generally speaking, assign objects to
groups. This is done via a multiple select box which displays an
object's name and uses its ID property as value.
So, usually, my action would get back a String array containing the
IDs of the selected objects. I want the framework to load the
corresponding objects from the database and pass them as a Collection
to my action's setObjects(Collection<Object> objects) method, so that
my action doesn't have to deal with loading objects.
So I wrote a type converter. The "convertFromString" method takes the
String array with the IDs, determines the target element type using
ObjectTypeDeterminer, loads the objects and returns them in a
collection. In this direction - form to action - it works quite well.
Great. I've never tried this myself. I suppose you run the risk of
some performance penalties doing it here (eg. select n+1 due to
iteration) and the conversion error exception is probably not ideal, but
otherwise I'm impressed.
Hi Jeromy
I'm not clear what the performance problem you mention could be. This is what
I'm doing myself and while my app's performance is OK, I would love to improve
it. What do you mean by (e.g. select n+1 due to iteration)?
All the best
Adam
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]