[CDO] Comparing object ids with OCL query [message #987766] |
Wed, 28 November 2012 02:21 |
Warwick Burrows Messages: 132 Registered: July 2009 Location: Austin, TX |
Senior Member |
|
|
Hi,
How would I write an OCL query to compare CDO model objects to determine whether one is the same instance as the other. The same in this case would mean they have the same cdo id. I'm after a query something like this:
MyCompany.allInstances()->select(e:MyCompany|e.shippingInfo = infoObject)
Where MyCompany contains an uncontained reference to a model object of type ShippingInfo which is called "shippingInfo" and I want to fetch all the MyCompany objects that have a specific instance of the ShippingInfo object called "infoObject" that has been reused among multiple instances of MyCompany. Is there a way to do an object comparison to determine if they are the same model object? I've tried doing the above query but got an illegal parameter exception. I also tried passing the CDOID object for infoObject instead but got the same error. Any suggestions would be appreciated.
One added question: Will the ocl query handling accept parameter types other than string? So far I've been using string parameter values and not had any trouble. But it doesn't seem to like CDOID objects or Long parameters.
Thanks,
Warwick
[Updated on: Wed, 28 November 2012 02:29] Report message to a moderator
|
|
|
Re: [CDO] Comparing object ids with OCL query [message #987771 is a reply to message #987766] |
Wed, 28 November 2012 04:15 |
|
Am 28.11.2012 03:21, schrieb Warwick Burrows:
> Hi,
>
> How would I write an OCL query to compare CDO model objects to whether one is the same instance as the other. The same
> in this case would mean they have the same cdo id. I'm after a query something like this:
>
> MyCompany.allInstances()->select(e:MyCompany|e.shippingInfo = infoObject)
>
> Where MyCompany contains an uncontained reference to a model object of type ShippingInfo which is called
> "shippingInfo" and I want to fetch all the MyCompany objects that have a specific instance of the ShippingInfo object
> called "infoObject" that has been reused among multiple instances of MyCompany. Is there a way to do an object
> comparison to determine if they are the same model object? I've tried doing the above query but got an illegal
> parameter exception.
It's always good to share the stack traces of exceptions ;-)
> I also tried passing the CDOID object for infoObject instead but got the same error. Any suggestions would be
> appreciated.
It strikes me that this is really an OCL question rather than a CDO one. Or did I miss something?
Unfortunately I'm everything but an OCL expert. Perhaps Christian is (cc'ed ). If others can't help here I'd suggest to
ask OCL questions on the OCl forum.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07457 seconds