cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Huss <johnth...@gmail.com>
Subject Re: Type safe queries & more
Date Thu, 15 Sep 2011 18:53:49 GMT
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
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message