Re: Upgrading from cayenne 2.0.4 to cayenne 3.0.M5/M6

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Jun 17 2009 - 03:02:56 EDT

  • Next message: Marco Gattei: "Re: Upgrading from cayenne 2.0.4 to cayenne 3.0.M5/M6"

    Hi Marco,

    I suspect "oracle.sql.TIMESTAMP" column is at fault here. Cayenne 3.0
    expands the type conversion strategy for unknown types to support
    Serializable types. The side effect of that is a clash with the Oracle
    non-standard types provided via JDBC. I've no idea if the following
    works, but could you try replacing oracle.sql.TIMESTAMP with
    java.sql.Timestamp?

    Andrus

    On Jun 16, 2009, at 5:52 PM, Marco Gattei wrote:

    > Hi everyone,
    >
    > i'm tryng to upgrade my projects from Cayenne 2.0.4 to Ceyenne
    > 3.0.M5 (M6)
    > Underlyng DB id Oracle 10 Express Edition.
    > In a project i have an extremely ugly looking, long SQLTemplate
    > query that
    > worked fine under Cayenne 2.0.4:
    >
    > SELECT DISTINCT
    > #result('t0.CODENTE' 'String' 'codiceEnte'),
    > #result('t0.DATAISTRUTTORIA' 'oracle.sql.TIMESTAMP'
    > 'dataistruttoria'),
    > #result('t0.FINEISTRUTTORIA' 'int' 'fineistruttoria'),
    > #result('t0.STATO' 'int' 'stato'),
    > #result('t0.AKEY' 'long' 'akey'),
    > #result('t0.ID_AVVOCATO' 'long' 'idAvvocato' ),
    > #result('t0.ID_VERBALE' 'long' 'idVerbale' ),
    > #result('t3.RICORRENTE' 'String' 'ricorrente'),
    > #result('t2.GP_DTUDIENZANEXT' 'java.util.Date' 'dataUdienza' ),
    > #result('t2.GP_NUMRG' 'String' 'registro'),
    > #result('t2.GP_NOMEGP' 'String' 'giudice'),
    > #result("'verbale'" 'String' 'tipo'),
    > #if ($fineIstruttoria==0)
    > #result("'istruttoria'" 'String' 'avvocato'),
    > #else
    > #result("'pendenti'" 'String' 'avvocato'),
    > #end
    > #result( "( select count(*) from ${RICORSI}.RICORSI_ALLEGATI_RICORSO
    > where ID_RICORSO_PENDENTE = t0.AKEY and ERRORE_TRASMISSIONE is not
    > null)" 'Integer' 'immagini')
    > FROM ${RICORSI}.RICORSI_PENDENTI t0,
    > ${PIEMME}.VER_CDS t1,
    > ${PIEMME}.CRICORSI t2,
    > ${PIEMME}.CRICDETT t3,
    > ${PIEMME}.CVIOLAZ t4
    >
    > WHERE t0.ID_VERBALE = t1.AKEY
    > AND t1.AKEY = t2.PARENT
    > AND t2.AKEY = t3.PARENT
    > AND t1.AKEY = t4.PARENT
    > AND t0.ID_AVVOCATO is null
    > AND t0.ID_VERBALE not in ( select parent from ${PIEMME}.CINGIUNZ )
    > #chain('and','and')
    > #chunk($fineIstruttoria) t0.FINEISTRUTTORIA =
    > #bind($fineIstruttoria) #end
    > #chunk($idAvvocato) t0.ID_AVVOCATO = #bind($idAvvocato) #end
    > #chunk($codEnte) t0.CODENTE =#bind($codEnte) #end
    > #chunk($dataUdIni) t2.GP_DTUDIENZANEXT >= #bind($dataUdIni) #end
    > #chunk($dataUdFin) t2.GP_DTUDIENZANEXT <= #bind($dataUdFin) #end
    > #chunk($ricorrente) UPPER(t3.RICORRENTE) like
    > UPPER(#bind($ricorrente)) #end
    > #chunk($gdp) UPPER(t2.GP_NOMEGP) like UPPER(#bind($gdp)) #end
    > #chunk($rg) t2.GP_NUMRG like #bind($rg) #end
    > #chunk($articolo) t4.ARTICOLO = #bind($articolo) #end
    > #end
    >
    >
    > I' upgraded cayenne.xml, switched t cayenne-3,.0X libraries and when
    > i try to execute the same query i get the following stacktrace:
    >
    > [Click] [error] handleException:
    > org.apache.cayenne.CayenneRuntimeException: [v.3.0M6 May 18 2009
    > 07:55:30] Query exception.
    > at
    > org
    > .apache
    > .cayenne
    > .access
    > .DataDomainQueryAction.nextQueryException(DataDomainQueryAction.java:
    > 549)
    > at
    > org.apache.cayenne.access.DataNode.performQueries(DataNode.java:281)
    > at
    > org
    > .apache
    > .cayenne
    > .access.DataDomainQueryAction.runQuery(DataDomainQueryAction.java:422)
    > at org.apache.cayenne.access.DataDomainQueryAction.access
    > $000(DataDomainQueryAction.java:66)
    > at org.apache.cayenne.access.DataDomainQueryAction
    > $2.transform(DataDomainQueryAction.java:395)
    > at
    > org
    > .apache.cayenne.access.DataDomain.runInTransaction(DataDomain.java:
    > 843)
    > at
    > org
    > .apache
    > .cayenne
    > .access
    > .DataDomainQueryAction
    > .runQueryInTransaction(DataDomainQueryAction.java:392)
    > at
    > org
    > .apache
    > .cayenne
    > .access.DataDomainQueryAction.execute(DataDomainQueryAction.java:118)
    > at
    > org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:736)
    > at
    > org
    > .apache
    > .cayenne
    > .util
    > .ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:333)
    > at
    > org
    > .apache
    > .cayenne
    > .util.ObjectContextQueryAction.execute(ObjectContextQueryAction.java:
    > 96)
    > at
    > org.apache.cayenne.access.DataContext.onQuery(DataContext.java:1276)
    > at
    > org.apache.cayenne.access.DataContext.performQuery(DataContext.java:
    > 1265)
    > at
    > net
    > .marco
    > .click
    > .service
    > .CayenneServiceTemplate.performQuery(CayenneServiceTemplate.java:246)
    > at
    > com
    > .sapidata
    > .ricorsi
    > .service
    > .PendentiService.getListaVerbaliPendentiDR(PendentiService.java:435)
    > at
    > com
    > .sapidata
    > .ricorsi
    > .service
    > .PendentiService.getListaVerbaliPendenti2(PendentiService.java:544)
    > at com.sapidata.ricorsi.web.avv.RicorsiPendentiPage.getListaRicorsi
    > (RicorsiPendentiPage.java:153)
    > at
    > com
    > .sapidata
    > .ricorsi.web.ElencoRicorsiPage.onRender(ElencoRicorsiPage.java:473)
    > at net.sf.click.ClickServlet.processPage(ClickServlet.java:588)
    > at net.sf.click.ClickServlet.handleRequest(ClickServlet.java:
    > 324)
    > at net.sf.click.ClickServlet.doGet(ClickServlet.java:250)
    > at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
    > at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    > at
    > org
    > .apache
    > .catalina
    > .core
    > .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
    > 252)
    > at
    > org
    > .apache
    > .catalina
    > .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    > at
    > net
    > .sf
    > .click
    > .extras.cayenne.DataContextFilter.doFilter(DataContextFilter.java:238)
    > at
    > org
    > .apache
    > .catalina
    > .core
    > .ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:
    > 202)
    > at
    > org
    > .apache
    > .catalina
    > .core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    > at
    > org
    > .apache
    > .catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:
    > 213)
    > at
    > org
    > .apache
    > .catalina.core.StandardContextValve.invoke(StandardContextValve.java:
    > 178)
    > at
    > org
    > .apache
    > .catalina
    > .authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:524)
    > at
    > org
    > .apache
    > .catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    > at
    > org
    > .apache
    > .catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    > at
    > org
    > .apache
    > .catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:
    > 107)
    > at
    > org
    > .apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:
    > 148)
    > at
    > org
    > .apache.coyote.http11.Http11Processor.process(Http11Processor.java:
    > 869)
    > at org.apache.coyote.http11.Http11BaseProtocol
    > $Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:
    > 664)
    > at
    > org
    > .apache
    > .tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:
    > 527)
    > at
    > org
    > .apache
    > .tomcat
    > .util
    > .net
    > .LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    > at org.apache.tomcat.util.threads.ThreadPool
    > $ControlRunnable.run(ThreadPool.java:684)
    > at java.lang.Thread.run(Thread.java:619)
    > Caused by: java.io.StreamCorruptedException: invalid stream header:
    > 786D0603
    > at
    > java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:783)
    > at java.io.ObjectInputStream.<init>(ObjectInputStream.java:280)
    > at org.apache.cayenne.access.types.SerializableTypeFactory
    > $SerializableType.toJavaObject(SerializableTypeFactory.java:112)
    > at
    > org
    > .apache
    > .cayenne
    > .access
    > .types
    > .ExtendedTypeDecorator.materializeObject(ExtendedTypeDecorator.java:
    > 53)
    > at
    > org
    > .apache.cayenne.access.jdbc.FullRowReader.readRow(FullRowReader.java:
    > 50)
    > at
    > org
    > .apache.cayenne.access.jdbc.FullRowReader.readRow(FullRowReader.java:
    > 31)
    > at
    > org
    > .apache
    > .cayenne
    > .access.jdbc.JDBCResultIterator.nextRow(JDBCResultIterator.java:197)
    > at
    > org
    > .apache
    > .cayenne
    > .access.jdbc.LimitResultIterator.nextRow(LimitResultIterator.java:104)
    > at
    > org
    > .apache
    > .cayenne
    > .access.jdbc.LimitResultIterator.allRows(LimitResultIterator.java:85)
    > at
    > org
    > .apache
    > .cayenne
    > .access
    > .jdbc.SQLTemplateAction.processSelectResult(SQLTemplateAction.java:
    > 238)
    > at
    > org
    > .apache
    > .cayenne
    > .dba
    > .oracle
    > .OracleSQLTemplateAction
    > .processSelectResult(OracleSQLTemplateAction.java:85)
    > at
    > org
    > .apache
    > .cayenne
    > .access.jdbc.SQLTemplateAction.execute(SQLTemplateAction.java:171)
    > at
    > org
    > .apache
    > .cayenne
    > .access.jdbc.SQLTemplateAction.performAction(SQLTemplateAction.java:
    > 127)
    > at
    > org
    > .apache
    > .cayenne
    > .access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:87)
    > at
    > org.apache.cayenne.access.DataNode.performQueries(DataNode.java:274)
    > ... 39 more
    >
    >
    > Seems to me something goes wrong while cayenne maps result set into
    > java Objects, but i cannot figure why .....
    >
    > If anybody has some hints ....
    >
    > Thanks Marco
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Jun 17 2009 - 03:03:31 EDT