Re: SQLTemplate returning NULL results

2013-05-28 Thread Andrus Adamchik
> But I am still missing the point where the List is converted into > actual objects of the Class defined into the ObjEntity associated with the > `root` class specified when creating the new SQLTemplate instance. DataDomainQueryAction.interceptObjectConversion(..) On May 29, 2013, at 2:33 AM, gi

Re: SQLTemplate returning NULL results

2013-05-28 Thread giulio.ces...@gmail.com
Andrus, I have looked closer into RowDescriptorBuilder.getDesciptor method. The returned RowDescriptor has the right (at least to my tired eyes) list of ColumnDescriptor. The only weird part I have seen, is that each ColumnDescriptor has the field `tableName` set to null (together with `namePrefi

Re: SQLTemplate returning NULL results

2013-05-28 Thread Andrus Adamchik
This is correct, but there's lots of obscure cases here that can be ignored. Take a look at: 1. RowDescriptorBuilder.getDescriptor(..) 2. JDBCResultIterator.createFullRowReader(..) 3. FullRowReader.readRow(..) RowDescriptor returned from 1 is fed to 2, that creates FullRowReader. 3 would actual

Re: SQLTemplate returning NULL results

2013-05-28 Thread giulio.ces...@gmail.com
Hello Andrus, I have dug through the code, and I have found a point where something I don't understand happens. When `SQLTemplateMetadata.resolve` method is invoked, `query.result()` return null, and this means that `resultSetMapping` is set to null. But the query is actually returning three res

Re: SQLTemplate returning NULL results

2013-05-28 Thread giulio.ces...@gmail.com
Jurgen, thanks for the tip; but I am either completely blind (as I can see no differences in the query compared to the structure of the DB), or there is something else going on in my case. As stated in the initial message, I have also tried using the same exact SQL statement logged by Cayenne whe

Re: SQLTemplate returning NULL results

2013-05-28 Thread giulio.ces...@gmail.com
Andrus, can you point me to the code where Cayenne tries to match what is returned by JDBC and tries to match it to DbEntity fields? Setting a breakpoint there I may be able to understand what is going wrong. Thanks, Giulio Cesare On Tue, May 28, 2013 at 2:50 PM, Andrus Adamchik wrote: > I t

Re: SQLTemplate returning NULL results

2013-05-28 Thread dollj
Hi Giulio, I've had this problem before. Try the following: goto SaleSummary in Cayenne Modeler and click on the attributes tab. Make sure that your SQLTemplate query contains all the DbAttributes listed. They must be spelt exactly the same way (CaPs SenSitiTive), order isn't important. Also the

Re: Upgrading Applications from Cayenne 3.0 to 3.1

2013-05-28 Thread Michael Gentry
I've started putting a CayenneUtils class in my 3.0 apps which has: public static DataContext newContext() { return DataContext.createDataContext(); } When I switch it over to 3.1, I'll change this method to create the context from the server runtime and also add the server ru

Re: SQLTemplate returning NULL results

2013-05-28 Thread Andrus Adamchik
Take a look at JDBCResultIterator. This is the heart of it. On May 28, 2013, at 4:00 PM, "giulio.ces...@gmail.com" wrote: > Andrus, > > can you point me to the code where Cayenne tries to match what is returned > by JDBC and tries to match it to DbEntity fields? > Setting a breakpoint there I

Re: Upgrading Applications from Cayenne 3.0 to 3.1

2013-05-28 Thread Malcolm Edgar
Ok thanks, that is good to know. regards malcolm Sent from my iPad On 28/05/2013, at 5:33 PM, Andrus Adamchik wrote: > The biggest difference is clearly the configuration and bootstrapping part. > Once you got a hold of your ObjectContext, the experience should be pretty > much the same. >

Re: SQLTemplate returning NULL results

2013-05-28 Thread Andrus Adamchik
I think the culprit is still what's in the ResultSet - Cayenne does not recognize the column names returned by JDBC. The reasons can be few… Another workaround might be to use #result directive to name each column to match a corresponding DbEntity name. A. On May 28, 2013, at 3:44 PM, giulio.c

Re: SQLTemplate returning NULL results

2013-05-28 Thread giulio.ces...@gmail.com
Hello Andrus, unfortunately your suggestion didn't help. I am now trying to build my project using Cayenne code base from repository Head, to see if I can spot what is going wrong. Thanks for the help. Regards, Giulio Cesare On Tue, May 28, 2013 at 9:24 AM, Andrus Adamchik wrote: > I think

Re: Upgrading Applications from Cayenne 3.0 to 3.1

2013-05-28 Thread Andrus Adamchik
The biggest difference is clearly the configuration and bootstrapping part. Once you got a hold of your ObjectContext, the experience should be pretty much the same. Andrus On May 25, 2013, at 8:36 AM, Malcolm Edgar wrote: > Hi All, > > I would like hear about peoples experiences upgrading

Re: SQLTemplate returning NULL results

2013-05-28 Thread Andrus Adamchik
I think I've seen it before. This could the column naming in the result set not exactly matching DbEntity. Try this maybe: query.setColumnNamesCapitalization(CapsStrategy.LOWER); And yes, we need to improve this in Cayenne - instead of NULLs we prolly need to throw an Exception or something.