cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joseph Senecal <sene...@apple.com>
Subject Re: Type safe queries & more
Date Thu, 15 Sep 2011 19:20:13 GMT
Thanks! I was planning on doing the same thing, just hadn't gotten to it yet. 

Joe

On Sep 15, 2011, at 11:58 AM, Hugi Thordarson wrote:

> Whoops, sorry about that.
> 
> Thanks for the suggestion, but I don't think this warrants a JIRA yet—the code is now
quite mature yet.
> 
> In any case, here are the files, if anyone is interested:
> 
> http://hugi.karlmenn.is/d/cayenne.zip
> 
> Cheers,
> - hugi
> 
> 
> 
> On 15.9.2011, at 18:53, John Huss wrote:
> 
>> Attachments are not allowed by the mailing list - I'd suggest opening a JIRA
>> and then sending a link to the list.  Thanks!
>> 
>> John
>> 
>> On Thu, Sep 15, 2011 at 1:29 PM, Hugi Thordarson <hugi@karlmenn.is> wrote:
>> 
>>> Hi all.
>>> 
>>> Cayenne beginner here. I come from an EOF/WebObjects background, so when I
>>> started using Cayenne (yesterday) I kinda missed the type safety and
>>> conciseness of using Mike Schrag's ERXKeys when constructing qualifiers and
>>> Orderings.
>>> 
>>> So me and another EOF guy (@atlipall) sat down today and
>>> recreated/reverse-engineered some of Mike's work to be usable with Cayenne.
>>> We're sharing this early, hoping it might be useful for someone else—and
>>> since we're total beginners and don't know much about Cayenne yet, comments
>>> are appreciated. (Perhaps we're even implementing pre-existing
>>> functionality; we just don't know :).
>>> 
>>> Anyway, by using the two attached classes and superclass template, you can
>>> write type safe code such as:
>>> 
>>> List<User> users = User.fetch( dataContext, User.FIRSTNAME.like( "joe%"
>>> ).and( User.AGE.between( 20, 30 ), User.FIRSTNAME.asc().then(
>>> User.LASTNAME.asc() ) );
>>> 
>>> (this would fetch all users named "joe"-something, aged betweeen 20 and 30,
>>> and order the list by first name, then last name.
>>> 
>>> We also added some convenience methods to the superclass template. These
>>> are:
>>> 
>>> fetchAll( ObjectContext );
>>> fetchAll( ObjectContext, List<Ordering> );
>>> fetch( ObjectContext, Expression );
>>> fetch( ObjectContext, Expression, List<Ordering> );
>>> fetchOne( ObjectContext, Expression );
>>> create{relationship_name}Relationship();
>>> delete{relationship_name}Relationship();
>>> 
>>> That's all for now.
>>> 
>>> Cheers,
>>> - hugi
>>> 
>>> 
> 


Mime
View raw message