cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrus Adamchik <and...@objectstyle.org>
Subject Re: Cayenne 3.0.3 Relationship fault when adding DBRelationShip join
Date Thu, 26 Apr 2012 09:27:37 GMT
Yeah, this is odd indeed. Somehow "uniquing" fails, i.e. the fetched object and the current
object are thought to be 2 different objects instead of one. In the past I've seen it happen
on some DBs with "fuzzy" numeric columns. E.g. Cayenne the fault object we are trying to resolve
would have *Integer* PK of 5, but the fetched object would have *BigDecimal* PK of 5, causing
ObjectId equality check to fail... 

In this case I suggest putting a breakpoint in debugger in BaseContext.java:171, and check
the contents of "objects" array vs "object". See if their ObjectId's are different (Hmm...
maybe in the future Cayenne can do some assertions itself and create a more descriptive message
for the Exception).

Andrus


On Apr 24, 2012, at 1:29 PM, Marco Gattei wrote:

> Hi everyone,
> 
>    recentlty i add to rework on a project that used Cayenne 3.0.1 .
> I did two modification:
> 
> -    upgrade to cayenne 3.0.2 ( worked fine )
> -    i had to change (by dba request ) one  of my relationship join, adding another field
 in the relationship
> from RICORSI_PENDENTI to VER_CDS  ( field CODENTE)
> 
> When i access one side of the relation ship from RICORSI_PENDENTI to VER_CDS i get this
exception.
> 
> 
> 10:06:32,952 INFO  QueryLogger     - SELECT t0.AKEY, t0.CODENTE, t0.NUMEROSOGGETTI, t0.DATARUOLO,
t0.DATAACCERTAMENTO, t0.ORAVERBALIZZAZIONE, t0.TARGA, t0.ID_VERBALIZZ1, t0.DATANOTIFICAINGIUNZIONE,
t0.ID_VERBALIZZ2, t0.LUOGO_VERB, t0.NUMEROBOLLETTA, t0.TIPOTARGA, t0.RACCOMANDATAVERBALE,
t0.SPESEAMMVE, t0.TIPOSUPPLEMENTARE, t0.DATAVERBALE, t0.FLAG_VARI, t0.VERBALIZZANTE1, t0.VERBALIZZANTE2,
t0.ID_STRADA2, t0.VERBALIZZANTE3, t0.ID_STRADA1, t0.USOMEZZO, t0.LOCATARIO, t0.SPESEALTRE,
t0.TIPOMEZZO, t0.NUMEROCIVICO, t0.PROTOCOLLOVERBALE, t0.DATARICORSO, t0.CODICESINISTRO, t0.DATAVERBALIZZAZIONE,
t0.TIPOV, t0.NUMEROREGISTRO, t0.TIPOVERBALE, t0.TIPO_VIOLAZ, t0.STRADA1, t0.STRADA2, t0.DATASPEDIZIONEVERBALE,
t0.MODELLO, t0.AUSILIARIO, t0.IMPORTOSANZIONI, t0.NAZIONE, t0.DATATRASMISSIONE, t0.TELAIO,
t0.ORAACCERTAMENTO, t0.SPESEPOSTALI, t0.DATATRASMISSIONERICORSO, t0.ID_LUOGO_VERB, t0.ANNOVERBALE,
t0.NOMEOPERATORE, t0.KILOMETRO, t0.DATANOTIFICAVERBALE, t0.MARCA, t0.VALUTA, t0.AGENTE2, t0.AGENTE1,
t0.STATOVERBALE, t0.ID_SINISTRO, t0.SUBSTATO, t0.DATAARCHIVIAZIONE, t0.RIMOSSO FROM piemme.VER_CDS
t0 WHERE (t0.AKEY = ?) AND (t0.CODENTE = ?) [bind: 1:200019405, 2:'H211']
> 10:06:32,968 INFO  QueryLogger     - === returned 1 row. - took 18 ms.
> 10:06:32,972 INFO  QueryLogger     - +++ transaction committed.
> [Click] [error] handleException: org.apache.cayenne.FaultFailureException: [v.3.0.2 apr
20 2012 16:13:44] Error resolving fault for ObjectId: <ObjectId:VerCds, AKEY=200019405,
CODENTE=H211> and state (hollow). Possible cause - matching row is missing from the database.
>    at org.apache.cayenne.BaseContext.prepareForAccess(BaseContext.java:171)
>    at org.apache.cayenne.CayenneDataObject.readProperty(CayenneDataObject.java:219)
>    at com.sapidata.piemme.domain.VerCds.getAnagrafiche(VerCds.java:50)
>    at com.sapidata.piemme.domain.VerCds.getAnagrafeNotificata(VerCds.java:61)
>    at com.sapidata.ricorsi.web.user.InfoPage.onInit(InfoPage.java:71)
>    at net.sf.click.ClickServlet.processPage(ClickServlet.java:509)
>    at net.sf.click.ClickServlet.handleRequest(ClickServlet.java:331)
>    at net.sf.click.ClickServlet.doGet(ClickServlet.java:250)
>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:627)
>    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
>    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)
>    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
>    at net.sf.click.extras.cayenne.DataContextFilter.doFilter(DataContextFilter.java:238)
>    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:215)
>    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)
>    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
>    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:172)
>    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:563)
>    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
>    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)
>    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:174)
>    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:879)
>    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
>    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
>    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
>    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:689)
>    at java.lang.Thread.run(Thread.java:662)
> 
> 
> It seems to me that the object VerCds( VER_CDS ) gets fetched from Cayenne, but for some
reason i get a Fault where accessing property "anagrafiche" which in turn is a relationship.
> 
> 
> if i get back to a single field relathionship from RICORSI_PENDENTI to VER_CDS i don't
get the fault and all the relationship of VER_CDS get correctly fetched:
> 
> 12:21:23,124 INFO  QueryLogger     - SELECT t0.AKEY, t0.CODENTE, t0.NUMEROSOGGETTI, t0.DATARUOLO,
t0.DATAACCERTAMENTO, t0.ORAVERBALIZZAZIONE, t0.TARGA, t0.ID_VERBALIZZ1, t0.DATANOTIFICAINGIUNZIONE,
t0.ID_VERBALIZZ2, t0.LUOGO_VERB, t0.NUMEROBOLLETTA, t0.TIPOTARGA, t0.RACCOMANDATAVERBALE,
t0.SPESEAMMVE, t0.TIPOSUPPLEMENTARE, t0.DATAVERBALE, t0.FLAG_VARI, t0.VERBALIZZANTE1, t0.VERBALIZZANTE2,
t0.ID_STRADA2, t0.VERBALIZZANTE3, t0.ID_STRADA1, t0.USOMEZZO, t0.LOCATARIO, t0.SPESEALTRE,
t0.TIPOMEZZO, t0.NUMEROCIVICO, t0.PROTOCOLLOVERBALE, t0.DATARICORSO, t0.CODICESINISTRO, t0.DATAVERBALIZZAZIONE,
t0.TIPOV, t0.NUMEROREGISTRO, t0.TIPOVERBALE, t0.TIPO_VIOLAZ, t0.STRADA1, t0.STRADA2, t0.DATASPEDIZIONEVERBALE,
t0.MODELLO, t0.AUSILIARIO, t0.IMPORTOSANZIONI, t0.NAZIONE, t0.DATATRASMISSIONE, t0.TELAIO,
t0.ORAACCERTAMENTO, t0.SPESEPOSTALI, t0.DATATRASMISSIONERICORSO, t0.ID_LUOGO_VERB, t0.ANNOVERBALE,
t0.NOMEOPERATORE, t0.KILOMETRO, t0.DATANOTIFICAVERBALE, t0.MARCA, t0.VALUTA, t0.AGENTE2, t0.AGENTE1,
t0.STATOVERBALE, t0.ID_SINISTRO, t0.SUBSTATO, t0.DATAARCHIVIAZIONE, t0.RIMOSSO FROM piemme.VER_CDS
t0 WHERE t0.AKEY = ? [bind: 1:200019405]
> 12:21:23,130 INFO  QueryLogger     - === returned 1 row. - took 7 ms.
> 12:21:23,130 INFO  QueryLogger     - +++ transaction committed.
> 12:21:23,131 INFO  QueryLogger     - --- will run 1 query.
> 12:21:23,131 INFO  QueryLogger     - --- transaction started.
> 12:21:23,134 INFO  QueryLogger     - SELECT DISTINCT t0.CODICENOTIFICAING, t0.CODICECONTRIBUENTE,
t0.LUOGORESIDENZA, t0.LUOGORILASCIODOCUMENTO, t0.CODFISCOMUNENASCITA, t0.DATANOTIFICAINGIUNZIONE,
t0.ANNONASCITA, t0.PROVRESIDENZA, t0.DATAPASSAGGIOPROPRIETA, t0.DATAIDENTIFICAZIONE, t0.SESSO,
t0.SPESEPT, t0.CODICEFISCALE, t0.NUMERODOCUMENTO, t0.SOCIETA, t0.CODENTE, t0.LUOGONASCITA,
t0.INDIRIZZORESIDENZA, t0.PARTITAIVA, t0.TIPOANAGRAFICA, t0.PARENTPROP, t0.PARENT, t0.DATANOTIFICARUOLO,
t0.DOCUMENTO, t0.DATANOTIFICAVERBALE, t0.COGNOME, t0.PROT_REINTEST, t0.SPESEAM, t0.TIPODOCUMENTO,
t0.QUINTOC, t0.ORIGINEDATI, t0.DATAAGGDATI, t0.NUMEROREGISTRO, t0.DATADOCUMENTO, t0.ANNO,
t0.DATANASCITA, t0.CAPRESIDENZA, t0.NOME, t0.CODICENOTIFICA, t0.AKEY FROM piemme.ANA_CDS t0
JOIN piemme.VER_CDS t1 ON (t0.PARENT = t1.AKEY AND t0.CODENTE = t1.CODENTE) WHERE t1.AKEY
= ? [bind: 1:200019405]
> 12:21:23,140 INFO  QueryLogger     - === returned 1 row. - took 9 ms.
> 12:21:23,140 INFO  QueryLogger     - +++ transaction committed.
> 12:21:23,141 INFO  QueryLogger     - --- will run 1 query.
> 12:21:23,141 INFO  QueryLogger     - --- transaction started.
> 12:21:23,144 INFO  QueryLogger     - SELECT DISTINCT t0.DATAREVOCA, t0.ESISTERICORSO,
t0.IMPORTOORIGINALE, t0.PROTOCOLLO, t0.DATANOTIFICAINGIUNZIONE, t0.IMPORTOINGIUNZIONE, t0.NUMEROBOLLETTA,
t0.SPESENOTINGORIG, t0.DATASTAMPA, t0.SPESENOTIFICAINGIUNZIONE, t0.NUM_RG_RICORSO, t0.PROTRICORSO,
t0.NOTE, t0.ESITORICORSOING, t0.CODENTE, t0.ANNOVERBALE, t0.ANNOINGIUNZIONE, t0.SPESEINGIUNZIONE,
t0.PARENT, t0.NUMEROINGIUNZIONE, t0.NUMEROREGISTRO, t0.SPEDIRE, t0.DATARICORSOING, t0.DATAINGIUNZIONE,
t0.DATAESITORICING, t0.DATASOSPENS, t0.AKEY FROM piemme.CINGIUNZ t0 JOIN piemme.VER_CDS t1
ON (t0.PARENT = t1.AKEY AND t0.CODENTE = t1.CODENTE) WHERE t1.AKEY = ? [bind: 1:200019405]
> 12:21:23,147 INFO  QueryLogger     - === returned 0 rows. - took 5 ms.
> 12:21:23,147 INFO  QueryLogger     - +++ transaction committed.
> 12:21:23,148 INFO  QueryLogger     - --- will run 1 query.
> 12:21:23,148 INFO  QueryLogger     - --- transaction started.
> 12:21:23,153 INFO  QueryLogger     - SELECT DISTINCT t0.GP_MANDDTBENE, t0.CONTRODEDUFFICIO,
t0.DTRIMB_SPESEACC, t0.GP_MANDDTRICH, t0.RIFERIMENTI_RIMB, t0.GP_DTDISPOS, t0.GP_TIPOSOSP,
t0.GP_NUMRG, t0.NUMEROBOLLETTA, t0.DTRICOUT, t0.GP_DTSOSPFIN, t0.DATA_RIC_PREF, t0.PROTRICOUT,
t0.DESCNOPROCED, t0.GP_DISPFL1, t0.GP_ISSPESE, t0.GP_PROTRICOUT, t0.DT_OPERATORE, t0.GP_DISPFL2,
t0.GP_DTUDIENZEDONE, t0.DATATRASMPREFETTO2, t0.CATEGORIARICORSO, t0.DATATRASMPREFETTO3, t0.RIFRIMB_SPESEACC,
t0.GP_DTTRASMATTI, t0.GP_GGVALPAGA, t0.NOME_OPERATORE, t0.DATA_RICHIESTARIMB, t0.GP_DTUDIENZANEXT,
t0.DATARICORSO, t0.PARENT, t0.GP_DTSOSPIN, t0.MOTIVAZIONI, t0.CODENTE, t0.GP_IMPSPES, t0.NUMEROREGISTRO,
t0.OBBL_CDEDAGENT, t0.DATASTCONTROD, t0.CODPAG, t0.DATA_BENESTARERRIMB, t0.DISPONIBILE, t0.GP_NOTE_MOTIVAZ,
t0.GP_DISPDT2, t0.GP_NOMEGP, t0.GP_DISPDT1, t0.GP_DTVALINI, t0.GP_IMPSANZ, t0.GP_DTRICOUT,
t0.AKEY, t0.RICEVUTA, t0.RICORSOTARDIVO, t0.IMPRIMB_SPESEACC, t0.GP_IMPSANZRUO, t0.AUDIZIONE_TIPO,
t0.NOTE, t0.AUTORITAGIUDIZIARIA, t0.GP_DISPCHAR3, t0.PROT_RIC_PREF, t0.GP_SPESEPROC, t0.GP_DISPCHAR1,
t0.ANNOVERBALE, t0.CONTRODEDUZIONE, t0.GP_DISPCHAR2, t0.PROTOCOLLORICORSO, t0.GP_PROTSPESE,
t0.GP_PROTDISPOS, t0.PROTOCOLLOPREFETTO, t0.PROCOTOLLOPREFETTO2, t0.VALUTA, t0.GP_MANDNUM,
t0.ESITORICORSO, t0.GP_IMPSPESRUO, t0.PROTOCOLLOPREFETTO3, t0.ANNORICORSO, t0.DATAESITO, t0.DATATRASMPREFETTO,
t0.AUDIZIONE, t0.GP_DTSPESE FROM piemme.CRICORSI t0 JOIN piemme.VER_CDS t1 ON (t0.PARENT =
t1.AKEY AND t0.CODENTE = t1.CODENTE) WHERE t1.AKEY = ? [bind: 1:200019405]
> 12:21:23,162 INFO  QueryLogger     - === returned 1 row. - took 14 ms.
> 12:21:23,162 INFO  QueryLogger     - +++ transaction committed.
> 12:21:23,167 INFO  QueryLogger     - --- will run 1 query.
> 12:21:23,167 INFO  QueryLogger     - --- transaction started.
> 12:21:23,173 INFO  QueryLogger     - {? = call piemme.GIORNONONFESTIVONEGATIVO(?, ?)}
[bind: 1:'[OUT]', 2:'2008-02-11 00:00:00.0', 3:-10]
> 12:21:23,196 INFO  QueryLogger     - === returned 1 row. - took 0 ms.
> 12:21:23,197 INFO  QueryLogger     - +++ transaction committed.
> 12:21:23,202 INFO  QueryLogger     - --- will run 1 query.
> 12:21:23,202 INFO  QueryLogger     - --- transaction started.
> 12:21:23,204 INFO  QueryLogger     - SELECT DISTINCT t0.CODENTE, t0.PREF_RIFCONF, t0.ANNOVERBALE,
t0.PROTOCOLLO, t0.AKEY, t0.CODICECAUSALE, t0.PARENT, t0.PREF_RIFTRASM, t0.NUMEROBOLLETTA,
t0.PREF_DTTRASM, t0.NUMEROARCHIVIAZIONE, t0.DATASTAMPA, t0.NUMEROREGISTRO, t0.PREF_DTCONF,
t0.DATAST_LETTERA, t0.ANNOORDINANZA, t0.DATAARCHIVIAZIONE, t0.CAUSALEARCHIVIAZIONE FROM PIEMME.CARCHIV
t0 JOIN piemme.VER_CDS t1 ON (t0.PARENT = t1.AKEY AND t0.CODENTE = t1.CODENTE) WHERE t1.AKEY
= ? [bind: 1:200019405]
> 12:21:23,207 INFO  QueryLogger     - === returned 0 rows. - took 5 ms.
> 12:21:23,207 INFO  QueryLogger     - +++ transaction committed.
> 12:21:23,208 INFO  QueryLogger     - --- will run 1 query.
> 12:21:23,209 INFO  QueryLogger     - --- transaction started.
> 12:21:23,212 INFO  QueryLogger     -  SELECT V.*  FROM PIEMME.VER_CDS V,PIEMME.T180PP
T  WHERE T.PARENT2_180_8 =  200019405  AND T.CODENTE = ? AND T.PARENT = V.akey AND T.CODENTE
= V.CODENTE [bind: 1:'H211']
> 12:21:23,222 INFO  QueryLogger     - === returned 0 rows. - took 10 ms.
> 12:21:23,223 INFO  QueryLogger     - +++ transaction committed.
> 12:21:23,223 INFO  QueryLogger     - --- will run 1 query.
> 12:21:23,224 INFO  QueryLogger     - --- transaction started.
> 12:21:23,225 INFO  QueryLogger     -  SELECT V.*  from PIEMME.VER_CDS V, PIEMME.T180
T  WHERE T.PARENT2_180_8 =  200019405 AND T.CODENTE = ? AND T.PARENT = V.akey AND T.CODENTE
= V.CODENTE [bind: 1:'H211']
> 12:21:23,229 INFO  QueryLogger     - === returned 0 rows. - took 4 ms.
> 12:21:23,230 INFO  QueryLogger     - +++ transaction committed.
> 
> I think i'm missing somthing in the modeler or my absution of simply adding a filed to
the RICORSI_PENDENTI --> VER_CDS relationship is wrong.
> 
> I hope i've expressed my problem with enough clarity .....
> Can somebody please provide some hint to put me in the rigth direction ?
> 
> Of cource i can fetch Data Rows wrinting an SQLTemplate script for resolving relatiohns
on the DB and then manage relathioship programatically, but i would like to use SelectQuery
with prefetch instead.
> 
> Thanks, Marco
> 
> 


Mime
View raw message