Re: Temp ID issue - Exception

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu Sep 27 2007 - 02:55:20 EDT

  • Next message: Gary Jarrel: "Cayenne Model XML"

    Thanks for the info. Looks like it was fixed in August as a part of
    another bugfix, and will be released in M2:

    ~/work/cayenne: svn diff framework/cayenne-jdk1.4-unpublished/src/
    main/java/org/apache/cayenne/map/AshwoodEntitySorter.java -r
    551302:565900
    Index: framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/
    cayenne/map/AshwoodEntitySorter.java
    ===================================================================
    --- framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/
    cayenne/map/AshwoodEntitySorter.java (revision 551302)
    +++ framework/cayenne-jdk1.4-unpublished/src/main/java/org/apache/
    cayenne/map/AshwoodEntitySorter.java (revision 565900)
    ..-302,16 +302,22 @@
              // find committed snapshot - so we can't fetch from the
    context as it will return
              // dirty snapshot; must go down the stack instead
    +
    + // how do we handle this for NEW objects correctly? For now
    bail from the method
    + if (object.getObjectId().isTemporary()) {
    + return null;
    + }
    +
              ObjectIdQuery query = new ObjectIdQuery(
                      object.getObjectId(),
                      true,
                      ObjectIdQuery.CACHE);
              QueryResponse response = context.getChannel().onQuery(null,
    query);
              List result = response.firstList();
    - if(result == null || result.size() == 0) {
    + if (result == null || result.size() == 0) {
                  return null;
              }
    -
    +
              DataRow snapshot = (DataRow) result.get(0);
              ObjectId id = snapshot.createTargetObjectId
    (targetEntityName, finalRel);

    Andrus

    On Sep 27, 2007, at 4:04 AM, Gary Jarrel wrote:

    > Although not able to reproduce was able to pull it out one of the
    > log files:
    >
    > ERROR au.com.jarrel.katya.proc.db.dao.CayenneDataContextInterceptor
    > (CayenneDataContextInterceptor.java:49) - Caught exception during
    > invocation, will try to roll back
    > org.apache.cayenne.CayenneRuntimeException: [v.3.0M1 Jul 27 2007
    > 23:05:47] Can't build a query for temporary id:
    > <ObjectId:Notification, TEMP:0000034FCA0C0101>
    > at org.apache.cayenne.query.ObjectIdQuery.createReplacementQuery
    > (ObjectIdQuery.java:120)
    > at org.apache.cayenne.query.IndirectQuery.getReplacementQuery
    > (IndirectQuery.java:75)
    > at org.apache.cayenne.query.IndirectQuery.route(IndirectQuery.java:
    > 58)
    > at org.apache.cayenne.access.DataDomainQueryAction.runQuery
    > (DataDomainQueryAction.java:408)
    > at org.apache.cayenne.access.DataDomainQueryAction.access$000
    > (DataDomainQueryAction.java:65)
    > at org.apache.cayenne.access.DataDomainQueryAction$2.transform
    > (DataDomainQueryAction.java:389)
    > at org.apache.cayenne.access.DataDomain.runInTransaction
    > (DataDomain.java:802)
    > at
    > org.apache.cayenne.access.DataDomainQueryAction.runQueryInTransaction(
    > DataDomainQueryAction.java:386)
    > at
    > org.apache.cayenne.access.DataDomainQueryAction.interceptOIDQuery
    > (DataDomainQueryAction.java:159)
    > at org.apache.cayenne.access.DataDomainQueryAction.execute
    > (DataDomainQueryAction.java:112)
    > at org.apache.cayenne.access.DataDomain.onQuery(DataDomain.java:722)
    > at org.apache.cayenne.map.AshwoodEntitySorter.findReflexiveMaster
    > (AshwoodEntitySorter.java:309)
    > at org.apache.cayenne.map.AshwoodEntitySorter.sortObjectsForEntity
    > (AshwoodEntitySorter.java:201)
    > at
    > org.apache.cayenne.access.DataDomainInsertBucket.appendQueriesInternal
    > (DataDomainInsertBucket.java:86)
    > at org.apache.cayenne.access.DataDomainSyncBucket.appendQueries
    > (DataDomainSyncBucket.java:75)
    > at org.apache.cayenne.access.DataDomainFlushAction.preprocess
    > (DataDomainFlushAction.java:181)
    > at org.apache.cayenne.access.DataDomainFlushAction.flush
    > (DataDomainFlushAction.java:133)
    > at org.apache.cayenne.access.DataDomain.onSyncFlush
    > (DataDomain.java:786)
    > at org.apache.cayenne.access.DataDomain$2.transform
    > (DataDomain.java:757)
    > at org.apache.cayenne.access.DataDomain.runInTransaction
    > (DataDomain.java:812)
    > at org.apache.cayenne.access.DataDomain.onSync(DataDomain.java:754)
    > at org.apache.cayenne.access.DataContext.flushToParent
    > (DataContext.java:1157)
    > at org.apache.cayenne.access.DataContext.commitChanges
    > (DataContext.java:1062)
    > at au.com.jarrel.katya.proc.db.dao.impl.BaseDaoImpl.commit
    > (BaseDaoImpl.java:89)
    > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    > at sun.reflect.NativeMethodAccessorImpl.invoke
    > (NativeMethodAccessorImpl.java:39)
    > at sun.reflect.DelegatingMethodAccessorImpl.invoke
    > (DelegatingMethodAccessorImpl.java:25)
    > at java.lang.reflect.Method.invoke(Method.java:585)
    > at
    > org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflectio
    > n(AopUtils.java:296)
    > at
    > org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoi
    > npoint(ReflectiveMethodInvocation.java:177)
    > at
    > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
    > (ReflectiveMethodInvocation.java:144)
    > at
    > au.com.jarrel.katya.proc.db.dao.CayenneDataContextInterceptor.invoke
    > (CayenneDataContextInterceptor.java:46)
    > at
    > org.springframework.aop.framework.ReflectiveMethodInvocation.proceed
    > (ReflectiveMethodInvocation.java:166)
    > at org.springframework.aop.framework.JdkDynamicAopProxy.invoke
    > (JdkDynamicAopProxy.java:204)
    > at $Proxy12.commit(Unknown Source)
    > at
    > au.com.jarrel.katya.proc.mail.pipeline.command.NotificationSendingComm
    > and.sendAndSaveEmailNotification(NotificationSendingCommand.java:181)
    > at
    > au.com.jarrel.katya.proc.mail.pipeline.command.NotificationSendingComm
    > and.sendNotification(NotificationSendingCommand.java:59)
    > at
    > au.com.jarrel.katya.proc.mail.pipeline.command.NotificationSendingComm
    > and.sendNotifications(NotificationSendingCommand.java:53)
    > at
    > au.com.jarrel.katya.proc.mail.pipeline.command.NotificationSendingComm
    > and.execute(NotificationSendingCommand.java:46)
    > at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:
    > 190)
    > at au.com.jarrel.katya.proc.mail.pipeline.SpringPipelineRunner.run
    > (SpringPipelineRunner.java:43)
    > at au.com.jarrel.katya.james.mailet.PipelineProcessor.service
    > (PipelineProcessor.java:30)
    > at org.apache.james.transport.LinearProcessor.service
    > (LinearProcessor.java:424)
    > at org.apache.james.transport.JamesSpoolManager.process
    > (JamesSpoolManager.java:405)
    > at org.apache.james.transport.JamesSpoolManager.run
    > (JamesSpoolManager.java:309)
    > at java.lang.Thread.run(Thread.java:595)
    >
    >
    > Hope this is of some value!
    >
    > Gary
    >
    > On 9/25/07, Gary Jarrel <garyjarre..mail.com> wrote:
    >> I will reconfigure the app to use 3.0M1 tonight and post the stack
    >> trace,
    >>
    >> Sorry for delay!
    >>
    >> On 9/22/07, Andrus Adamchik <andru..bjectstyle.org> wrote:
    >>> A few more questions.
    >>>
    >>> Could you provide a more complete stack trace (just include the
    >>> entire Cayenne part of the stack), as I am wondering where in the
    >>> Cayenne code the failing query is fired?
    >>>
    >>
    >



    This archive was generated by hypermail 2.0.0 : Thu Sep 27 2007 - 02:55:51 EDT