You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Markus Reich <ma...@markusreich.at> on 2011/11/04 00:31:40 UTC

Probkem with SQLTemplate

Hi community,

I'm trying to receive a SELECT DISTINCT query by a SQLTemplate call, I got
the right count of objects, but all objects are NULL?
I've tried nearly everything, with and without #result directive ...

The strange thing is, that I didn't get any exceptions thrown? Is there a
way to use a deeper logging?

regards
Markus

Re: Probkem with SQLTemplate

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Markus,

The observed behavior means that Cayenne doesn't know how to map the result data to a object (we should probably detect this condition and throw an exception, but that's the way it is now).

You need to ensure that you include all columns that are mapped for a given entity in Cayenne model in your SELECT clause (or do "SELECT * ... "). Once you've done that, another caveat is column name capitalization, so you may have to enforce UPPER or LOWER caps strategy:

http://cayenne.apache.org/doc30/advanced-sqltemplate.html

Andrus

On Nov 4, 2011, at 2:31 AM, Markus Reich wrote:

> Hi community,
> 
> I'm trying to receive a SELECT DISTINCT query by a SQLTemplate call, I got
> the right count of objects, but all objects are NULL?
> I've tried nearly everything, with and without #result directive ...
> 
> The strange thing is, that I didn't get any exceptions thrown? Is there a
> way to use a deeper logging?
> 
> regards
> Markus