Well, Cayenne doesn't "force" you to use SQL.
What it /does/ do is to /allow/ you to use SQL.
An app I wrote awhile back had the requirement to generate reports
from tables with on the order of a million records.
There was no substitute for hand crafted, carefully optimized
queries. Cayenne makes it easy to do that, if the need arises, via
SQLTemplate.
But SQLTemplate offers more than "just" SQL. You can script it (via
velocity [http://velocity.apache.org] directives and variables); you
can write customized queries for different backends (MySQL, HSQL,
Oracle, etc.) which then "just work" based on which backend you're
connected to (ie: in your code, you don't have to think about which
backend you're connected to).
But, if you're interested in sticking to object paths and
relationships, EJBQLQuery provides a nice alternative.
Robert
On Apr 8, 2009, at 4/82:27 PM , Weddle, Anthony wrote:
Thanks, Andrus. I'll take a look at EJBQL and may have to revisit
SQLTemplates. It's not that the latter is scary, just that it
appears to
be native SQL, rather than being able to used property paths and class
or object entity names. We're using an ORM framework to avoid native
SQL
wherever we can, so wouldn't want to switch to a framework that forced
us back to more of it.
One of the main problems I'm having is that there is so little
documentation, books and articles about Cayenne. Is there a fairly
comprehensive list of publications (not necessarily books) on Cayenne?
Tony
-----Original Message-----
From: Andrus Adamchik [mailto:and...@objectstyle.org]
Sent: Wednesday, 8 April 2009 5:46 p.m.
To: user@cayenne.apache.org
Subject: Re: General queries
Cayenne 3.0 includes support for EJBQLQuery which seem like you what
you need here:
http://cayenne.apache.org/doc/ejbqlquery.html
We are following the JPA syntax per JSR-220
(http://jcp.org/aboutJava/communityprocess/final/jsr220/index.html
). At does support aggregates, separate columns, subqueries, etc.
Anything not supported by the EJBQLQuery will indeed require a
SQLTemplate, which is not as scary as it sounds.
Hope this helps.
Andrus
NOTICE - This message and any attached files may contain information
that is confidential, legally privileged or proprietary. It is
intended only for use by the intended recipient. If you are not the
intended recipient or the person responsible for delivering the
message to the intended recipient, be advised that you have received
this message in error. Any dissemination, copying, use or re-
transmission of this message or attachment, or the disclosure of any
information therein, is strictly forbidden. BlueScope Steel Limited
does not represent or guarantee that this message or attachment is
free of errors, virus or interference.
If you have received this message in error please notify the sender
immediately and delete the message. Any views expressed in this
email are not necessarily the views of BlueScope Steel Limited.