You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Lance Eason <la...@whisperwire.com> on 2003/03/26 23:05:17 UTC

Can QueryCustomizer be used to suppress foreign key queries

I have a table that may have child records in two other tables.  This easy enough to map, I just create the collection-descriptors mapping to the two child tables and OJB issues queries to populate these collections.  The wrinkle is that these relationships are only applicable to a small subset of the rows in the table and I can tell from the other data in the row whether they are applicable or not.  There's no functional issue here, but I'd rather not be doing unnecessary database queries on all the rows I can clearly tell there is no need to pursue these two relationships.  Is there any way to enable or suppress relationships on a row by row basis?
 
QueryCustomizer looks promising as it takes the instance for the row and gets to decide the specific query that's executed to populate the collection for that instance.  I don't see a way to entirely suppress a query though.  Is there one?

Re: Can QueryCustomizer be used to suppress foreign key queries

Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi lance,

you'e the query cannot be suppressed.
btw. what should be returned for a suppressed query, null or an empty 
collection ?

jakob

Lance Eason wrote:

>I have a table that may have child records in two other tables.  This easy enough to map, I just create the collection-descriptors mapping to the two child tables and OJB issues queries to populate these collections.  The wrinkle is that these relationships are only applicable to a small subset of the rows in the table and I can tell from the other data in the row whether they are applicable or not.  There's no functional issue here, but I'd rather not be doing unnecessary database queries on all the rows I can clearly tell there is no need to pursue these two relationships.  Is there any way to enable or suppress relationships on a row by row basis?
> 
>QueryCustomizer looks promising as it takes the instance for the row and gets to decide the specific query that's executed to populate the collection for that instance.  I don't see a way to entirely suppress a query though.  Is there one?
>
>  
>