You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Brian McCallister <mc...@forthillcompany.com> on 2004/07/08 04:30:22 UTC

[OJB 1.1] Criteria API Change

I would like to add change all of the various "Criteria.add*(..): void" 
methods to return a Criteria instance, the same one called against. 
This will allow chaining criteria calls a la:

criteria = criteria.addEqualTo("foo", foo).addGreaterThan("bar", 
bar).addLike("baz", baz);

This will break drop-in jar replacement without a recompile, but will 
work fine with a recompile on existing code as they all return void 
now.

-brian



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: [OJB 1.1] Criteria API Change

Posted by Thomas Dudziak <to...@first.fhg.de>.
Jakob Braeuchi wrote:

> adding to the criteria provides more flexibiltity than adding to the 
> query.
> you can ie. 'or' two criteria or you can negate a whole criteria.

You're right, of course, but I still think that it does look strange 
(but so does the SODA Api). But since I'm not forced to use it (i.e. I 
can ignore the return value and build the criteria before), I don't 
really have a problem with it anyway.

Tom


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: [OJB 1.1] Criteria API Change

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

adding to the criteria provides more flexibiltity than adding to the query.
you can ie. 'or' two criteria or you can negate a whole criteria.

jakob

Thomas Dudziak wrote:

> Brian McCallister wrote:
> 
>> I would like to add change all of the various "Criteria.add*(..): 
>> void" methods to return a Criteria instance, the same one called 
>> against. This will allow chaining criteria calls a la:
>>
>> criteria = criteria.addEqualTo("foo", foo).addGreaterThan("bar", 
>> bar).addLike("baz", baz);
>>
>> This will break drop-in jar replacement without a recompile, but will 
>> work fine with a recompile on existing code as they all return void now.
> 
> 
> This looks pretty close to the SODA Api then, except that you have add 
> prefixes and you add at the criteria (which looks somewhat strange to 
> me) instead of the query ?
> 
> Tom
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-dev-help@db.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Re: [OJB 1.1] Criteria API Change

Posted by Thomas Dudziak <to...@first.fhg.de>.
Brian McCallister wrote:

> I would like to add change all of the various "Criteria.add*(..): void" 
> methods to return a Criteria instance, the same one called against. This 
> will allow chaining criteria calls a la:
> 
> criteria = criteria.addEqualTo("foo", foo).addGreaterThan("bar", 
> bar).addLike("baz", baz);
> 
> This will break drop-in jar replacement without a recompile, but will 
> work fine with a recompile on existing code as they all return void now.

This looks pretty close to the SODA Api then, except that you have add 
prefixes and you add at the criteria (which looks somewhat strange to 
me) instead of the query ?

Tom

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org