Hi Chris!
I think you encountered bug that has already been fixed [1]. You can try
last build instead of M4.
[1]. https://issues.apache.org/cayenne/browse/CAY-1081
2008/10/7, Chris Murphy <chri..trandz.org>:
>
>
> I have a Swing application that is being converted from using JDO to using
> Cayenne. It uses ROP and calls some Spring services. On the server
> WebApplicationContextFilter is being used. Some of the Spring services
> return more than just straightforward objects like Strings, they return DOs
> as well. I want these DOs to work in the application just like any other -
> so I want them to be part of the application's DataContext, and I want them
> to be of the client variety. My current best theory approach is for PK
> values to be returned rather than DOs, and for the method
> DataObjectUtils.objectForPk() to be used when a real DO is required. Is this
> an approach that ought to work?
>
> I'll concentrate on one of the types of DOs that comes across: Worker.
> Using the debugger I can see that the Workers are of the Cayenne server
> variety and still contain their PKs (but not much else). Thus I can test the
> above 'best theory' approach:
>
> This works fine:
> int toReplacePK = DataObjectUtils.intPKForObject(
> (Persistent)toReplace);
>
> With the PK I would think from the doco that DataObjectUtils.objectForPK()
> would be able to give me the kind of DO I want.
>
> However this does not work:
> result = DataObjectUtils.objectForPK(
> objectContext,
>
> org.strandz.data.wombatrescue.objects.cayenne.client.Worker.class,
> toReplacePK);
>
> This is what the error looks like:
> org.apache.cayenne.exp.ExpressionException: [v.3.0M4 May 18 2008 16:32:02]
> Can't resolve path component: [worker.jdoid].
> at
> org.apache.cayenne.map.PathComponentIterator.invalidPathException(PathComponentIterator.java:146)
>
> The error is coming from the server. It makes sense that the object is
> being fetched from the server as it has not been queried. Should I be able
> to use DataObjectUtils.objectForPK() from an ROP client?
>
> thanks - Chris Murphy
>
> --
> Seaweed Software Pty Ltd,
> http://www.strandz.org
>
>
This archive was generated by hypermail 2.0.0 : Tue Oct 07 2008 - 05:29:45 EDT