Hi Lindsay,
DataObjectUtils is the way to go. I will write some documentation for
it for the upcoming release, but it is very simple to use (see API at
http://objectstyle.org/cayenne/api/cayenne/org/objectstyle/cayenne/
DataObjectUtils.html). Here is one example:
DataContext context = ...;
Artist artist = (Artist) DataObjectUtils.objectForPK(context,
Artist.class, 5);
Hope this helps
Andrus
On Sep 12, 2004, at 3:41 AM, Lindsay Steele wrote:
>
> I have to do a query for a single object. The only way to identify
> this object is to use it's primary key.
>
> It is just showing the details for that object.
>
> I have read through previous mailing list posts .. And have come up
> with two ways of doing this ...
>
> One solution was something like this ...
>
> Expression expExtn =
> ExpressionFactory.matchDbExp("EXTENSION_NO_PK_COLUMN", extn);
>
> This does not seem to work .... It comes back with the following
> error
> ..
>
> "[v.1.1B2 July 25 2004] Can't resolve path component:
> [extension.EXTENSION_NO_PK_COLUMN]"
>
> I also see another solution being giving that is said to be even
> better. It is to use
> the DataObjectUtils class. I am not exactly sure how to implement
> this though ?? I like to see code examples
> of how something is being done.
>
> Does anyone have any code examples on how to use the DataObjectUtils
> .... Or can they see anything wrong
> with the matchDbExp I am trying use.
>
> Thanks,
>
> Lindsay
>
>
>
>
>
This archive was generated by hypermail 2.0.0 : Sun Sep 12 2004 - 22:01:46 EDT