You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Øyvind Harboe <oy...@zylin.com> on 2006/07/19 17:55:51 UTC

DataContext.localObject() on uncommitted objects

Is it supported to pass an ObjectId for an uncommitted
CayenneDataObject (i.e. where getObjectId().isTemproary()==true) to
DataContext.localObject()?


The reason I ask, is that I'm struggling with the exception below.

The scenario as best as I can tell is:

- Create a new CayenneDataObject
- Create a child context
- Transfer the newly created CayenneObject to the childcontext using
DataContext.localObject() (I haven't tried creating the
CayenneDataObject in the child)
- modify the CayenneDataObject in the child context
- commitToParent on the child context
- At this point I create a new child datacontext and transfer the same
CayenneDataObject to the child using localObject()
- At this point the readProperty() on the object causes the exception below


org.objectstyle.cayenne.CayenneRuntimeException
Temporary id can't be used in RelationshipQuery: <ObjectId:TreatCost,
TEMP:000000791D3C010B>
unlabeledMessage: 	Temporary id can't be used in RelationshipQuery:
<ObjectId:TreatCost, TEMP:000000791D3C010B>
Stack Trace:

    * org.objectstyle.cayenne.query.RelationshipQuery.<init>(RelationshipQuery.java:112)
    * org.objectstyle.cayenne.access.DataContextFaults$ToOneFault.doResolveFault(DataContextFaults.java:139)
    * org.objectstyle.cayenne.access.DataContextFaults$ToOneFault.resolveFault(DataContextFaults.java:117)
    * org.objectstyle.cayenne.CayenneDataObject.readProperty(CayenneDataObject.java:245)


-- 
Øyvind Harboe
http://www.zylin.com

Re: DataContext.localObject() on uncommitted objects

Posted by Øyvind Harboe <oy...@zylin.com>.
On 7/19/06, Andrus Adamchik <an...@objectstyle.org> wrote:
> I can confirm - it's a bug. I just fixed it on 1.2 branch; will
> commit the fix to HEAD shortly.

Yup. Works on my rocket as well. Go team! Super! Thanks! :-)


-- 
Øyvind Harboe
http://www.zylin.com

Re: DataContext.localObject() on uncommitted objects

Posted by Andrus Adamchik <an...@objectstyle.org>.
Are you seeing any related exceptions?

I haven't tested it specifically for the client, but the SVN commit  
logs attached to the issue only show changes to RelationshipQuery  
which is tier-agnostic:

http://svn.apache.org/viewvc?view=rev&revision=423572

Andrus

On Sep 14, 2006, at 3:46 AM, Lachlan Deck wrote:

> Hi there,
>
> On 20/07/2006, at 5:04 AM, Andrus Adamchik wrote:
>
>> I can confirm - it's a bug. I just fixed it on 1.2 branch; will  
>> commit the fix to HEAD shortly.
>>
>> http://issues.apache.org/cayenne/browse/CAY-601
>
> Andrus, I noticed you closed this task but could you also double  
> check if CayenneContext's (for client side) implementation of the  
> same is also up to snuff.
>
> Thanks...
>
> with regards,
> --
>
> Lachlan Deck
>
>
>
>


Re: DataContext.localObject() on uncommitted objects

Posted by Lachlan Deck <la...@gmail.com>.
Hi there,

On 20/07/2006, at 5:04 AM, Andrus Adamchik wrote:

> I can confirm - it's a bug. I just fixed it on 1.2 branch; will  
> commit the fix to HEAD shortly.
>
> http://issues.apache.org/cayenne/browse/CAY-601

Andrus, I noticed you closed this task but could you also double  
check if CayenneContext's (for client side) implementation of the  
same is also up to snuff.

Thanks...

with regards,
--

Lachlan Deck




Re: DataContext.localObject() on uncommitted objects

Posted by Mike Kienenberger <mk...@gmail.com>.
Hmm.   This sounds far too similar to my own problem.   I'd like to
see if this fixes my problem as well.

Ugh -- apache archive :-(
http://mail-archives.apache.org/mod_mbox/incubator-cayenne-user/200607.mbox/raw/%3c8f985b960607051220q426e433fg563a151d0fde96c9@mail.gmail.com%3e

Objectstyle thread:
http://objectstyle.org/cayenne/lists/cayenne-user/2006/07/0010.html


On 7/19/06, Andrus Adamchik <an...@objectstyle.org> wrote:
> I can confirm - it's a bug. I just fixed it on 1.2 branch; will
> commit the fix to HEAD shortly.
>
> http://issues.apache.org/cayenne/browse/CAY-601
>
> Andrus
>
>
> On Jul 19, 2006, at 11:55 AM, Øyvind Harboe wrote:
>
> > Is it supported to pass an ObjectId for an uncommitted
> > CayenneDataObject (i.e. where getObjectId().isTemproary()==true) to
> > DataContext.localObject()?
> >
> >
> > The reason I ask, is that I'm struggling with the exception below.
> >
> > The scenario as best as I can tell is:
> >
> > - Create a new CayenneDataObject
> > - Create a child context
> > - Transfer the newly created CayenneObject to the childcontext using
> > DataContext.localObject() (I haven't tried creating the
> > CayenneDataObject in the child)
> > - modify the CayenneDataObject in the child context
> > - commitToParent on the child context
> > - At this point I create a new child datacontext and transfer the same
> > CayenneDataObject to the child using localObject()
> > - At this point the readProperty() on the object causes the
> > exception below
> >
> >
> > org.objectstyle.cayenne.CayenneRuntimeException
> > Temporary id can't be used in RelationshipQuery: <ObjectId:TreatCost,
> > TEMP:000000791D3C010B>
> > unlabeledMessage:     Temporary id can't be used in RelationshipQuery:
> > <ObjectId:TreatCost, TEMP:000000791D3C010B>
> > Stack Trace:
> >
> >    * org.objectstyle.cayenne.query.RelationshipQuery.<init>
> > (RelationshipQuery.java:112)
> >    * org.objectstyle.cayenne.access.DataContextFaults
> > $ToOneFault.doResolveFault(DataContextFaults.java:139)
> >    * org.objectstyle.cayenne.access.DataContextFaults
> > $ToOneFault.resolveFault(DataContextFaults.java:117)
> >    * org.objectstyle.cayenne.CayenneDataObject.readProperty
> > (CayenneDataObject.java:245)
> >
> >
> > --
> > Øyvind Harboe
> > http://www.zylin.com
> >
>
>

Re: DataContext.localObject() on uncommitted objects

Posted by Andrus Adamchik <an...@objectstyle.org>.
I can confirm - it's a bug. I just fixed it on 1.2 branch; will  
commit the fix to HEAD shortly.

http://issues.apache.org/cayenne/browse/CAY-601

Andrus


On Jul 19, 2006, at 11:55 AM, Øyvind Harboe wrote:

> Is it supported to pass an ObjectId for an uncommitted
> CayenneDataObject (i.e. where getObjectId().isTemproary()==true) to
> DataContext.localObject()?
>
>
> The reason I ask, is that I'm struggling with the exception below.
>
> The scenario as best as I can tell is:
>
> - Create a new CayenneDataObject
> - Create a child context
> - Transfer the newly created CayenneObject to the childcontext using
> DataContext.localObject() (I haven't tried creating the
> CayenneDataObject in the child)
> - modify the CayenneDataObject in the child context
> - commitToParent on the child context
> - At this point I create a new child datacontext and transfer the same
> CayenneDataObject to the child using localObject()
> - At this point the readProperty() on the object causes the  
> exception below
>
>
> org.objectstyle.cayenne.CayenneRuntimeException
> Temporary id can't be used in RelationshipQuery: <ObjectId:TreatCost,
> TEMP:000000791D3C010B>
> unlabeledMessage: 	Temporary id can't be used in RelationshipQuery:
> <ObjectId:TreatCost, TEMP:000000791D3C010B>
> Stack Trace:
>
>    * org.objectstyle.cayenne.query.RelationshipQuery.<init> 
> (RelationshipQuery.java:112)
>    * org.objectstyle.cayenne.access.DataContextFaults 
> $ToOneFault.doResolveFault(DataContextFaults.java:139)
>    * org.objectstyle.cayenne.access.DataContextFaults 
> $ToOneFault.resolveFault(DataContextFaults.java:117)
>    * org.objectstyle.cayenne.CayenneDataObject.readProperty 
> (CayenneDataObject.java:245)
>
>
> -- 
> Øyvind Harboe
> http://www.zylin.com
>