Hi Jason,

> 2) Using a CacheFilter to filter out 'Owners' where the
ownershipPercent is
> 0.
This is definitely the wrong way to fulfill your condition.

>
> 1) Using a custom RowReader on the 'Owner' class descriptor to filter
out
> the unwanted rows/objects

Implement a custom RowReader seems a good way
for filtering objects. You can find an similar example
in docu
http://db.apache.org/ojb/tutorial3.html#rowreader example

regards,
Armin

----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 28, 2003 1:30 PM
Subject: [repost] Best way to globally filter objects during fetch.
RowReader or CacheFilter?


> Thomas/Armin,
>
> What is the best way to filter instances of a class every time that
it's
> fetched by OJB?  Here is my situation...
>
>
> I have a class called 'Owner' which has an attribute
'ownershipPercent'.  I
> want any queries run by OJB against this class to ALWAYS filter out
> records/objects whose ownershipPercent == 0.0.  Of course, the obvious
way
> to do this is to add this condition to my Criteria everywhere in my
code
> that I fetch 'Owners'.  Although, I can do this, it's not really
practical
> when I consider the amount of time it's going to take me and when I
> consider the regression impacts.  I have been considering the use of
one of
> the following:
>
> 1) Using a custom RowReader on the 'Owner' class descriptor to filter
out
> the unwanted rows/objects
> 2) Using a CacheFilter to filter out 'Owners' where the
ownershipPercent is
> 0.
>
> Either solution seems like it *might* suit my need as it will handle
any
> fetches on these objects gotten via collection descriptors, reference
> descriptors, or just queries against the 'Owner' class itself.
>
> Am I on the right track at all??  If so, which of these solutions is
> better?  I have looked into the use of the RowReader and was wondering
how
> to fit this functionality into the readObjectArrayFrom method and I
wasn't
> sure if it was wise to simply skip rows in the ResultSet or not.
>
> Thanks in advance,
> Jason
>
>
>
>
>
> ---------------------------------------------------------------------
> 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