It's not safe. If you have to return a value from "handleRow",
introduce a private variable.
private Person newPersonFromHandleRow;
public void handleRow(Object valueObject)
{
Person person = (Person) valueObject;
newPersonFromHandleRow = MyFactory.createSubClassObject( person );
}
But out of curiosity, why would you use "handleRow" to return a single
object? RowHandler is intended to handle situations where number of
rows being returned from the query is too large to be held into a list.
On Tue, 29 Jan 2008 20:42:22 -0500, "Hugh Ross" <[EMAIL PROTECTED]>
said:
> I have the good fortune to work on a large domain model, part of which
> uses
> too much inheritance. I don't want to use a huge outer join with 15 or
> 20
> tables in it. I'm wondering if I can use RowHandlers to help. In
> particular, is it possible for a RowHandler to replace the object passed
> to
> the handleRow method?
>
> E.g.,
> **
> *public void handleRow (Object valueObject)
> throws SQLException {
> Person person = (Person) valueObject;
> valueObject = MyFactory.createSubClassObject( person );*
> *}
> *
> Any other sample solutions to this kind of problem are also most
> welcome...
> *
> *
--
http://www.fastmail.fm - Does exactly what it says on the tin