If you still interested.. I found a solution of how to perform simple
SQLTemplate query without mapping.
In you example it will be like:
DataMap someDataMap = ..... // get it from somewhere... e.g. from DataContext
SQLTemplate template = new SQLTemplate(someDataMap, "SELECT
max(ordering) as MAX_ORDERING FROM user_bookmark WHERE userid=$uid");
template.setParameters(Collections.singletonMap("uid", user.getId()));
template.setFetchingDataRows(true);
List<DataRow> res = context.performQuery(template);
Integer maxOrdering = null;
if (res != null) {
DataRow row =res.get(0);
if (row != null) {
maxOrdering = (Integer) row.get("MAX_ORDERING");
}
}
if (maxOrdering == null) {
maxOrdering = 0;
}
Hope it can help you...
Best regards,
Evgeny Ryabitskiy.
2009/10/2 Evgeny Ryabitskiy <evgeny.ryabitski..mail.com>:
>> Unfortunately there is an empty page at
>> http://cayenne.apache.org/doc/modeling-queries.html
>
>> I would also report a broken link on the front page for the Wiki (
>> http://cayenne.apache.org/CAY/index.html)
>
>> I would also recomend a FAQ section on the main page which would answer
>> common questions, like "How do I do SELECT count(*) FROM artist WHERE
>> first_name LIKE '%abl%'
>
> Best way to get any Cayenne Improvement (Documentation or
> Functionality) is to report an issue in JIRA.
> https://issues.apache.org/jira/secure/BrowseProject.jspa
> It's not hard.
>
> Once issue is reported you got every notify about every it's change in
> progress. And the main advantage that since issue reported, it's not
> going to be lost as in this mail list....
> One problem is that JIRA not working properly last few days... hope it
> will be fixed....
>
>
>
>> And that holds true for EJBQLQuery as well does it not? Maybe there should
>> be an advice somewhere in the docs that one must use DataRows as soon as
>> there is just one non-mapped attribute in the query.
>
> I'v created an JIRA issue for this
> https://issues.apache.org/jira/browse/CAY-1287
> The progress of fix should be faster, if you someday registry in JIRA
> and vote for it... ;)
>
>
> Best regards,
> Evgeny Ryabitskiy.
>
This archive was generated by hypermail 2.0.0 : Fri Oct 02 2009 - 10:17:41 EDT