Hi,
I'm trying to fetch some non-mappable rows and the best I could come
up with is this code:
98 SQLTemplate query = new SQLTemplate(Wsoutptr.class, sql, true);
99 query.setFetchingDataRows(true);
100 query.setPageSize(rowsPerPage);
101 query.setLoggingLevel(org.apache.log4j.Level.DEBUG);
102 List result = ctx.performQuery(query);
103 if(result.size() >= 2)
104 {
105 System.out.println("result.get(0) =" + result.get(0));
106 System.out.println("result.get(1) =" + result.get(1));
107 }
The main problem here is that I need to use an SQLTemplate because I
build the query myself and I don't know how to build one without a
reference to a specific class.
Interestingly, 'result.get(0)' gives me correct results but as soon
as the next element is fetched with 'result.get(1)' I get a mapping
error. Shouldn't this be so there would be no mapping thanks to the
query.setFetchingDataRows(true) call?
All I want is the Map with the three values {wsdeba_sum=57125.0, wsdis=,
FAKEGROUPINDICATOR=1} but for every row, not just the first one.
Here's the log:
QUERY=[SELECT 1 AS FAKEGROUPINDICATOR,wsdis AS wsdis,SUM(wsdeba) AS
wsdeba_sum FROM wsoutptr LEFT JOIN aharthur ON (wsoutptr.wsanr =
aharthur.ahanr) WHERE 1 AND (0 OR wsarg = 'ICA') GROUP BY wsdis ORDER
BY wsdeba_sum desc] TABLESORT=[]
result.size() =30
result.get(0) =org.objectstyle.cayenne.DataRo..10e91
[version=-9223372036854775790, replaces=-9223372036854775808, values=
{wsdeba_sum=57125.0, wsdis=, FAKEGROUPINDICATOR=1}]
INFO QueryLogger: --- will run 1 query.
INFO QueryLogger: --- transaction started.
INFO QueryLogger: *** error.
org.objectstyle.cayenne.exp.ExpressionException: [v.1.2M3 March 20
2005] Can't resolve path component: [WSOUTPTR.FAKEGROUPINDICATOR].
at org.objectstyle.cayenne.map.Entity$PathIterator.next
(Entity.java:319)
at
org.objectstyle.cayenne.access.trans.QueryAssemblerHelper.appendDbPath
(QueryAssemblerHelper.java:163)
at
org.objectstyle.cayenne.access.trans.QualifierTranslator.objectNode
(QualifierTranslator.java:372)
at org.objectstyle.cayenne.exp.Expression.traverse
(Expression.java:558)
at org.objectstyle.cayenne.exp.Expression.traverse
(Expression.java:555)
at org.objectstyle.cayenne.exp.Expression.traverse
(Expression.java:535)
at
org.objectstyle.cayenne.access.trans.QualifierTranslator.doTranslation
(QualifierTranslator.java:109)
at
org.objectstyle.cayenne.access.trans.SelectTranslator.createSqlString
(SelectTranslator.java:162)
at
org.objectstyle.cayenne.access.trans.QueryAssembler.createStatement
(QueryAssembler.java:131)
at org.objectstyle.cayenne.access.jdbc.SelectAction.performAction
(SelectAction.java:107)
at org.objectstyle.cayenne.access.DataNode.runSelect
(DataNode.java:364)
at org.objectstyle.cayenne.access.DataNode.performQueries
(DataNode.java:316)
at org.objectstyle.cayenne.access.DataDomain.performQueries
(DataDomain.java:573)
at org.objectstyle.cayenne.access.DataContext.performQueries
(DataContext.java:1175)
at org.objectstyle.cayenne.access.Transaction.performQueries
(Transaction.java:179)
at org.objectstyle.cayenne.access.DataContext.performQueries
(DataContext.java:1133)
at
org.objectstyle.cayenne.access.DataContextSelectAction.performQuery
(DataContextSelectAction.java:154)
at
org.objectstyle.cayenne.access.DataContextSelectAction.performQuery
(DataContextSelectAction.java:87)
at org.objectstyle.cayenne.access.DataContext.performQuery
(DataContext.java:1242)
at
org.objectstyle.cayenne.access.IncrementalFaultList.resolveInterval
(IncrementalFaultList.java:364)
at org.objectstyle.cayenne.access.IncrementalFaultList.get
(IncrementalFaultList.java:603)
at Fsys.Models.FSGenericTableModel.PerformQuery
(FSGenericTableModel.java:106)
Thanks,
Andreas Pardeike
This archive was generated by hypermail 2.0.0 : Fri Jul 01 2005 - 10:13:54 EDT