cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Willerding <awillerd...@callistacti.com>
Subject Re: DB2 V7 strange bug I think
Date Fri, 13 May 2011 15:10:05 GMT
I tried this to see if it would work and unfortunately it doesn't work.

Here's the code.

         ObjectContext context = BaseContext.getThreadObjectContext();
         SQLTemplate select = new SQLTemplate(SurveyResultDetails.class, 
sqlQuery);
         // select.setTemplate(DB2Adapter.class.getName(), sqlQuery);
         select.setFetchingDataRows(true);
         // select.setColumnNamesCapitalization(CapsStrategy.UPPER);

         List list = context.performQuery(select);
         DataContext dc = new DataContext();
         for (Iterator it = list.iterator(); it.hasNext();) {
             // SurveyResultDetails item = (SurveyResultDetails)it.next();
             DataRow x = (DataRow)it.next();
System.out.println("x-" + x);
             SurveyResultDetails item = 
dc.objectFromDataRow(SurveyResultDetails.class, x, false);

And here's the result:


2011-05-13 11:06:55,909 [http-8084-2] INFO  
org.apache.cayenne.access.QueryLogger - Select * from 
SurveyResultDetails where survey_id = 1 and question in (Select question 
from SurveyQuestions, SurveyQuestionTypes where SurveyQuestionTypes.id = 
5 and SurveyQuestions.question_type_id = 5) order by result, survey_dts
2011-05-13 11:06:55,914 [http-8084-2] INFO  
org.apache.cayenne.access.QueryLogger - === returned 3 rows. - took 5 ms.
2011-05-13 11:06:55,914 [http-8084-2] INFO  
org.apache.cayenne.access.QueryLogger - +++ transaction committed.
x-org.apache.cayenne.DataRow@229a94b3[values={id=50, result=0, 
caller_id=5001110410145147, survey_dts=Sun Apr 10 14:53:17 EDT 2011, 
rec_msg=101453001, question=12, lang=EN, survey_id=1, note=}, 
version=-9223372036854775804, replaces=-9223372036854775808]
May 13, 2011 11:06:55 AM com.vaadin.Application terminalError
SEVERE: Terminal error:
java.lang.NullPointerException
         at 
org.apache.cayenne.access.DataContext.objectFromDataRow(DataContext.java:638)
         at 
com.callistacti.survey.database.SurveyResultDetails.generateReport(SurveyResultDetails.java:58)
         at 
com.callistacti.survey.database.SurveyResultDetails.loadTable(SurveyResultDetails.java:149)
         at 
com.callistacti.survey.Panels.PanelFeedback.<init>(PanelFeedback.java:167)
         at 
com.callistacti.survey.Windows.WindowMain$3.menuSelected(WindowMain.java:295)
         at com.vaadin.ui.MenuBar.changeVariables(MenuBar.java:178)
         at 
com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariableBurst(AbstractCommunicationManager.java:1297)
         at 
com.vaadin.terminal.gwt.server.AbstractCommunicationManager.handleVariables(AbstractCommunicationManager.java:1217)
         at 
com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:733)
         at 
com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:296)
         at 
com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:483)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at 
org.apache.cayenne.conf.WebApplicationContextFilter.doFilter(WebApplicationContextFilter.java:93)
         at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at 
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
         at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
         at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
         at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
         at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852)
         at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
         at 
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
         at java.lang.Thread.run(Thread.java:619)


On 05/13/2011 09:27 AM, Michael Gentry wrote:
> DataContext can convert a DataRow to a DataObject for you:
>
> <T extends DataObject>  T objectFromDataRow(Class<T>  objectClass,
> DataRow dataRow, boolean refresh)
>
> mrg
>
>
> On Fri, May 13, 2011 at 9:21 AM, Andrew Willerding
> <awillerding@callistacti.com>  wrote:
>> That worked to retrieve a DataRow object.  The data is there now.  Is there
>> some way to convert this now into a usable cayenne data object without
>> pulling the columns out of the HashMap one column at a time?  Or is there an
>> underlying bug that is at the root why this is works for MySQL but not for
>> DB2 V7?
>>


-- 
Andrew Willerding
Callista CTI

   ph: 416 444-9702 x9455
   fx: 416 444-9732
cell: 416 712-2323
  www: http://www.callistacti.com


Mime
View raw message