cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hugi Thordarson <h...@karlmenn.is>
Subject Re: EJBQL limit
Date Mon, 15 Aug 2016 10:10:19 GMT
>>> Does Cayenne’s EJBQL support LIMIT expressions? I see I can set a fetch limit
on an EJBQLQuery, but it seems that this will just limit the size of the resultset generated
by the query, not the SQL generation (resulting in huge execution times for large queries).
>>> 
>>> Cheers,
>>> - hugi
>> 
>> Yeah, the way it is implemented is not particularly efficient. The limit functionality
is external to the syntax, and hence doesn't make it to the generated SQL. We can either patch
EJBQL, or wait for the bright future when EJBQL and ObjectSelect and made one :)

That’s a bright future indeed :).


> Out of interest Hugi, why are you using EJBQL? Is this legacy code moved to Cayenne and
this was the easiest way forward? Or are there features of Cayenne's incomplete EJBQL implementation
you like better than the other SQL Template or ObjectSelect api?

I’m doing a lot of reporting style stuff at the moment, EJBQL is really rather nice for
that. For example I often have to traverse long relationships paths and just being able to
fetch and qualify on keypaths rather then spell out all the joins makes the EJBQL much easier
to write than SQL. But 90% of what I’m doing could use ObjectSelect if DataRow queries supported
limiting the set of fetched columns. Below is an example of what I used to do in EOF for those
queries:

EOFetchSpecification fs = new EOFetchSpecification( “Person" );
fs.setFetchesRawRows( true );
fs.setRawRowKeyPaths( "name", "department.name", "address.city.country" );

- hugi
Mime
View raw message