You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Hugh Ross <hh...@gmail.com> on 2008/01/30 17:23:09 UTC

Safe to replace valueObject in RowHandler?

Trying to be more specific:

Is it safe to create another object in the handleRow method, and set the
valueObject to it?

Is it safe to use queryForObject from within a handleRow method?  I've seen
other posts that imply it is.

Will that object then replace the original one, if it was created by a
queryForList or queryForObject call?  If I don't hear back, I guess I'll try
it to see...

Thanks...

On 1/29/08, Hugh Ross <hh...@gmail.com> wrote:
>
>
> 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...
> * *
>

Re: Safe to replace valueObject in RowHandler?

Posted by Hugh Ross <hh...@gmail.com>.
Actually, it is even harder -- we'd like to use Lazy Loading of the
associations into this hierarchy.  I think that means we could not use a
RowHandler, anyway...


On 1/30/08, Hugh Ross <hh...@gmail.com> wrote:
>
>
> Good indexing, but Outer Join required.  We are OK with discriminator for
> our smaller hierarchies, but unfortunately we have some large ones, too.
>
>
>  On 1/30/08, Clinton Begin <cl...@gmail.com> wrote:
> >
> >  If it's an inner join, properly indexed, it shouldn't be too bad....
> >
> >
> >
> > *From:* Hugh Ross [mailto:hh4ross@gmail.com]
> > *Sent:* January-30-08 12:36 PM
> > *To:* user-java@ibatis.apache.org
> > *Subject:* Re: Safe to replace valueObject in RowHandler?
> >
> >
> >
> >
> >
> > Yes, we have begun experimenting with discriminators and subMaps.  But,
> > I want to avoid a 15 table join...
> >
> >
> >
> > On 1/30/08, *Clinton Begin* <cl...@gmail.com> wrote:
> >
> > Unfortunately that's not possible in Java, let alone with iBATIS.
> >
> >
> >
> > If you're just trying to create subclasses based on a type column in the
> > database, look up "discriminator" in the ibatis documentation or mailing
> > list archives...
> >
> >
> >
> > Clinton
> >
> >
> >
> > *From:* Hugh Ross [mailto:hh4ross@gmail.com]
> > *Sent:* January-30-08 9:23 AM
> > *To:* user-java@ibatis.apache.org
> > *Subject:* Safe to replace valueObject in RowHandler?
> >
> >
> >
> >
> >
> > Trying to be more specific:
> >
> >
> >
> > Is it safe to create another object in the handleRow method, and set the
> > valueObject to it?
> >
> >
> >
> > Is it safe to use queryForObject from within a handleRow method?  I've
> > seen other posts that imply it is.
> >
> >
> >
> > Will that object then replace the original one, if it was created by a
> > queryForList or queryForObject call?  If I don't hear back, I guess I'll try
> > it to see...
> >
> >
> > Thanks...
> >
> >
> > On 1/29/08, *Hugh Ross* <hh...@gmail.com> wrote:
> >
> >
> >
> > 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...
> >
> > * *
> >
> >
> >
> >
> >
>
>

Re: Safe to replace valueObject in RowHandler?

Posted by Hugh Ross <hh...@gmail.com>.
Good indexing, but Outer Join required.  We are OK with discriminator for
our smaller hierarchies, but unfortunately we have some large ones, too.


On 1/30/08, Clinton Begin <cl...@gmail.com> wrote:
>
>  If it's an inner join, properly indexed, it shouldn't be too bad....
>
>
>
> *From:* Hugh Ross [mailto:hh4ross@gmail.com]
> *Sent:* January-30-08 12:36 PM
> *To:* user-java@ibatis.apache.org
> *Subject:* Re: Safe to replace valueObject in RowHandler?
>
>
>
>
>
> Yes, we have begun experimenting with discriminators and subMaps.  But, I
> want to avoid a 15 table join...
>
>
>
> On 1/30/08, *Clinton Begin* <cl...@gmail.com> wrote:
>
> Unfortunately that's not possible in Java, let alone with iBATIS.
>
>
>
> If you're just trying to create subclasses based on a type column in the
> database, look up "discriminator" in the ibatis documentation or mailing
> list archives...
>
>
>
> Clinton
>
>
>
> *From:* Hugh Ross [mailto:hh4ross@gmail.com]
> *Sent:* January-30-08 9:23 AM
> *To:* user-java@ibatis.apache.org
> *Subject:* Safe to replace valueObject in RowHandler?
>
>
>
>
>
> Trying to be more specific:
>
>
>
> Is it safe to create another object in the handleRow method, and set the
> valueObject to it?
>
>
>
> Is it safe to use queryForObject from within a handleRow method?  I've
> seen other posts that imply it is.
>
>
>
> Will that object then replace the original one, if it was created by a
> queryForList or queryForObject call?  If I don't hear back, I guess I'll try
> it to see...
>
>
> Thanks...
>
>
> On 1/29/08, *Hugh Ross* <hh...@gmail.com> wrote:
>
>
>
> 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...
>
> * *
>
>
>
>
>

RE: Safe to replace valueObject in RowHandler?

Posted by Clinton Begin <cl...@gmail.com>.
If it's an inner join, properly indexed, it shouldn't be too bad....

 

From: Hugh Ross [mailto:hh4ross@gmail.com] 
Sent: January-30-08 12:36 PM
To: user-java@ibatis.apache.org
Subject: Re: Safe to replace valueObject in RowHandler?

 

 

Yes, we have begun experimenting with discriminators and subMaps.  But, I
want to avoid a 15 table join...

 

On 1/30/08, Clinton Begin <cl...@gmail.com> wrote: 

Unfortunately that's not possible in Java, let alone with iBATIS.  

 

If you're just trying to create subclasses based on a type column in the
database, look up "discriminator" in the ibatis documentation or mailing
list archives...

 

Clinton

 

From: Hugh Ross [mailto:hh4ross@gmail.com] 
Sent: January-30-08 9:23 AM
To: user-java@ibatis.apache.org
Subject: Safe to replace valueObject in RowHandler?

 

 

Trying to be more specific:

 

Is it safe to create another object in the handleRow method, and set the
valueObject to it?

 

Is it safe to use queryForObject from within a handleRow method?  I've seen
other posts that imply it is.

 

Will that object then replace the original one, if it was created by a
queryForList or queryForObject call?  If I don't hear back, I guess I'll try
it to see...
 

Thanks...
 

On 1/29/08, Hugh Ross <hh...@gmail.com> wrote: 

 

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...

 

 

 


Re: Safe to replace valueObject in RowHandler?

Posted by Hugh Ross <hh...@gmail.com>.
Yes, we have begun experimenting with discriminators and subMaps.  But, I
want to avoid a 15 table join...


On 1/30/08, Clinton Begin <cl...@gmail.com> wrote:
>
>  Unfortunately that's not possible in Java, let alone with iBATIS.
>
>
>
> If you're just trying to create subclasses based on a type column in the
> database, look up "discriminator" in the ibatis documentation or mailing
> list archives...
>
>
>
> Clinton
>
>
>
> *From:* Hugh Ross [mailto:hh4ross@gmail.com]
> *Sent:* January-30-08 9:23 AM
> *To:* user-java@ibatis.apache.org
> *Subject:* Safe to replace valueObject in RowHandler?
>
>
>
>
>
> Trying to be more specific:
>
>
>
> Is it safe to create another object in the handleRow method, and set the
> valueObject to it?
>
>
>
> Is it safe to use queryForObject from within a handleRow method?  I've
> seen other posts that imply it is.
>
>
>
> Will that object then replace the original one, if it was created by a
> queryForList or queryForObject call?  If I don't hear back, I guess I'll try
> it to see...
>
>
> Thanks...
>
>
> On 1/29/08, *Hugh Ross* <hh...@gmail.com> wrote:
>
>
>
> 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...
>
> * *
>
>
>

RE: Safe to replace valueObject in RowHandler?

Posted by Brian Parkinson <pa...@avaning.com>.
Seconded - great book.
 
parki...
 

________________________________

From: Brandon Goodin [mailto:brandon.goodin@gmail.com] 
Sent: Wednesday, January 30, 2008 11:36 AM
To: user-java@ibatis.apache.org
Subject: Re: Safe to replace valueObject in RowHandler?


Or you can buy iBATIS in Action...

http://www.amazon.com/iBatis-Action-Clinton-Begin/dp/1932394826/ref=pd_b
bs_sr_1?ie=UTF8&s=books&qid=1201710921&sr=8-1


On Jan 30, 2008 10:29 AM, Clinton Begin <cl...@gmail.com> wrote:


	Unfortunately that's not possible in Java, let alone with
iBATIS.  

	 

	If you're just trying to create subclasses based on a type
column in the database, look up "discriminator" in the ibatis
documentation or mailing list archives...

	 

	Clinton

	 

	From: Hugh Ross [mailto:hh4ross@gmail.com] 
	Sent: January-30-08 9:23 AM
	To: user-java@ibatis.apache.org
	Subject: Safe to replace valueObject in RowHandler?

	 

	 

	Trying to be more specific:

	 

	Is it safe to create another object in the handleRow method, and
set the valueObject to it?

	 

	Is it safe to use queryForObject from within a handleRow method?
I've seen other posts that imply it is.

	 

	Will that object then replace the original one, if it was
created by a queryForList or queryForObject call?  If I don't hear back,
I guess I'll try it to see...
	 

	Thanks...
	 

	On 1/29/08, Hugh Ross <hh...@gmail.com> wrote: 

	 

	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...

	 

	 



Re: Safe to replace valueObject in RowHandler?

Posted by Brandon Goodin <br...@gmail.com>.
Or you can buy iBATIS in Action...

http://www.amazon.com/iBatis-Action-Clinton-Begin/dp/1932394826/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1201710921&sr=8-1

On Jan 30, 2008 10:29 AM, Clinton Begin <cl...@gmail.com> wrote:

>  Unfortunately that's not possible in Java, let alone with iBATIS.
>
>
>
> If you're just trying to create subclasses based on a type column in the
> database, look up "discriminator" in the ibatis documentation or mailing
> list archives...
>
>
>
> Clinton
>
>
>
> *From:* Hugh Ross [mailto:hh4ross@gmail.com]
> *Sent:* January-30-08 9:23 AM
> *To:* user-java@ibatis.apache.org
> *Subject:* Safe to replace valueObject in RowHandler?
>
>
>
>
>
> Trying to be more specific:
>
>
>
> Is it safe to create another object in the handleRow method, and set the
> valueObject to it?
>
>
>
> Is it safe to use queryForObject from within a handleRow method?  I've
> seen other posts that imply it is.
>
>
>
> Will that object then replace the original one, if it was created by a
> queryForList or queryForObject call?  If I don't hear back, I guess I'll try
> it to see...
>
>
> Thanks...
>
>
> On 1/29/08, *Hugh Ross* <hh...@gmail.com> wrote:
>
>
>
> 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...
>
> * *
>
>
>

RE: Safe to replace valueObject in RowHandler?

Posted by Clinton Begin <cl...@gmail.com>.
Unfortunately that's not possible in Java, let alone with iBATIS.  

 

If you're just trying to create subclasses based on a type column in the
database, look up "discriminator" in the ibatis documentation or mailing
list archives...

 

Clinton

 

From: Hugh Ross [mailto:hh4ross@gmail.com] 
Sent: January-30-08 9:23 AM
To: user-java@ibatis.apache.org
Subject: Safe to replace valueObject in RowHandler?

 

 

Trying to be more specific:

 

Is it safe to create another object in the handleRow method, and set the
valueObject to it?

 

Is it safe to use queryForObject from within a handleRow method?  I've seen
other posts that imply it is.

 

Will that object then replace the original one, if it was created by a
queryForList or queryForObject call?  If I don't hear back, I guess I'll try
it to see...
 

Thanks...
 

On 1/29/08, Hugh Ross <hh...@gmail.com> wrote: 

 

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...