Home » Modeling » EMF » [CDO] Cannot pass object as parameter into cdoquery
|
Re: [CDO] Cannot pass object as parameter into cdoquery [message #714475 is a reply to message #714453] |
Wed, 10 August 2011 15:35 |
|
Hi David,
That sounds like RFE 259330: [Query] Support transient objects to be passed between client <-> server,
https://bugs.eclipse.org/bugs/show_bug.cgi?id=259330
Note that there has been no progress on it since almost 3 years.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
Am 10.08.2011 16:24, schrieb David Wynter:
> Hi,
>
> I am using the sql syntax for my query language in CDO 3.0
>
> I tried this
>
> UUID etlGrpUUID = (UUID)workItem.getParameter("ETLGroup UUID");
> CDOSession sess = EDMCDOSession.getSession();
> CDOTransaction transaction = sess.openTransaction();
>
> CDOQuery cdoq = transaction.createQuery("sql", "SELECT CDO_ID FROM ETLGroup WHERE UUID = :etlGrpUUID") ;
> cdoq.setParameter("uuid", etlGrpUUID);
> List<ETLGroup> result = cdoq.getResult(ETLGroup.class);
>
> I get
>
> Caused by: java.lang.UnsupportedOperationException: Object not persisted
> at org.eclipse.emf.internal.cdo.query.CDOQueryImpl.adapt(CDOQueryImpl.java:143)
> at org.eclipse.emf.internal.cdo.query.CDOQueryImpl.createQueryInfo(CDOQueryImpl.java:129)
> at org.eclipse.emf.internal.cdo.query.CDOQueryImpl.createQueryResult(CDOQueryImpl.java:66)
> at org.eclipse.emf.internal.cdo.query.CDOQueryImpl.getResult(CDOQueryImpl.java:77)
> at com.yambina.edm.edmengine.workitems.ETLGroupWorkItemHandler.executeWorkItem(ETLGroupWorkItemHandler.java:39)
>
>
> If I replace the parameter with a String that matches the name of the ETLGroup it works. E.G.
> createQuery("sql", "SELECT CDO_ID FROM ETLGroup etl WHERE name = :name") ;
> So how come it does not work for my UUID object?
>
> Thx.
>
> David
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO] Cannot pass object as parameter into cdoquery [message #714556 is a reply to message #714475] |
Wed, 10 August 2011 20:29 |
David Wynter Messages: 4624 Registered: July 2009 |
Senior Member |
|
|
Hi,
Maybe not quite the same. What I need to do is take the refId we have
for a UUID we store in a BPMN2 workflow xml and get CDO to retrieve the
actual object in the repo we have for where this UUID matches that of
the one in the repo. What we do is take this String representation and
create a new UUID object, this is what I am using in the query. We only
have sql, we did not use hql because there are limitations. If we had
hql I suppose we could do something like
createQuery("sql", "SELECT CDO_ID FROM
ETLGroup etl WHERE etl.UUID.msb = :msb AND etl.UUID.lsb = :lsb") ;
where we get the lsb Long and the msb Long from the UUID we have created.
How should we go about that given we only have sql and our objects are
all uniquely identified by the UUID objects?
Thx.
David
On 10/08/11 16:35, Eike Stepper wrote:
> Hi David,
>
> That sounds like RFE 259330: [Query] Support transient objects to be
> passed between client <-> server,
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=259330
>
> Note that there has been no progress on it since almost 3 years.
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>
> Am 10.08.2011 16:24, schrieb David Wynter:
>> Hi,
>>
>> I am using the sql syntax for my query language in CDO 3.0
>>
>> I tried this
>>
>> UUID etlGrpUUID = (UUID)workItem.getParameter("ETLGroup UUID");
>> CDOSession sess = EDMCDOSession.getSession();
>> CDOTransaction transaction = sess.openTransaction();
>>
>> CDOQuery cdoq = transaction.createQuery("sql", "SELECT CDO_ID FROM
>> ETLGroup WHERE UUID = :etlGrpUUID") ;
>> cdoq.setParameter("uuid", etlGrpUUID);
>> List<ETLGroup> result = cdoq.getResult(ETLGroup.class);
>>
>> I get
>>
>> Caused by: java.lang.UnsupportedOperationException: Object not persisted
>> at
>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.adapt(CDOQueryImpl.java:143)
>>
>> at
>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.createQueryInfo(CDOQueryImpl.java:129)
>>
>> at
>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.createQueryResult(CDOQueryImpl.java:66)
>>
>> at
>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.getResult(CDOQueryImpl.java:77)
>>
>> at
>> com.yambina.edm.edmengine.workitems.ETLGroupWorkItemHandler.executeWorkItem(ETLGroupWorkItemHandler.java:39)
>>
>>
>>
>> If I replace the parameter with a String that matches the name of the
>> ETLGroup it works. E.G.
>> createQuery("sql", "SELECT CDO_ID FROM ETLGroup etl WHERE name =
>> :name") ;
>> So how come it does not work for my UUID object?
>>
>> Thx.
>>
>> David
|
|
| | |
Re: [CDO] Cannot pass object as parameter into cdoquery [message #714629 is a reply to message #714556] |
Thu, 11 August 2011 06:29 |
|
Am 10.08.2011 22:29, schrieb David Wynter:
> Hi,
>
> Maybe not quite the same. What I need to do is take the refId we have for a UUID we store in a BPMN2 workflow xml and
> get CDO to retrieve the actual object in the repo we have for where this UUID matches that of the one in the repo.
> What we do is take this String representation and create a new UUID object, this is what I am using in the query. We
> only have sql, we did not use hql because there are limitations. If we had hql I suppose we could do something like
>
> createQuery("sql", "SELECT CDO_ID FROM
> ETLGroup etl WHERE etl.UUID.msb = :msb AND etl.UUID.lsb = :lsb") ;
> where we get the lsb Long and the msb Long from the UUID we have created.
>
> How should we go about that given we only have sql and our objects are all uniquely identified by the UUID objects?
I must be misunderstanding something. Why isn't it sufficient to either set one query parameter to s string form of your
UUID or two parameters to the two long values?
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
>
> Thx.
>
> David
>
> On 10/08/11 16:35, Eike Stepper wrote:
>> Hi David,
>>
>> That sounds like RFE 259330: [Query] Support transient objects to be
>> passed between client <-> server,
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=259330
>>
>> Note that there has been no progress on it since almost 3 years.
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>
>> Am 10.08.2011 16:24, schrieb David Wynter:
>>> Hi,
>>>
>>> I am using the sql syntax for my query language in CDO 3.0
>>>
>>> I tried this
>>>
>>> UUID etlGrpUUID = (UUID)workItem.getParameter("ETLGroup UUID");
>>> CDOSession sess = EDMCDOSession.getSession();
>>> CDOTransaction transaction = sess.openTransaction();
>>>
>>> CDOQuery cdoq = transaction.createQuery("sql", "SELECT CDO_ID FROM
>>> ETLGroup WHERE UUID = :etlGrpUUID") ;
>>> cdoq.setParameter("uuid", etlGrpUUID);
>>> List<ETLGroup> result = cdoq.getResult(ETLGroup.class);
>>>
>>> I get
>>>
>>> Caused by: java.lang.UnsupportedOperationException: Object not persisted
>>> at
>>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.adapt(CDOQueryImpl.java:143)
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.createQueryInfo(CDOQueryImpl.java:129)
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.createQueryResult(CDOQueryImpl.java:66)
>>>
>>> at
>>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.getResult(CDOQueryImpl.java:77)
>>>
>>> at
>>> com.yambina.edm.edmengine.workitems.ETLGroupWorkItemHandler.executeWorkItem(ETLGroupWorkItemHandler.java:39)
>>>
>>>
>>>
>>> If I replace the parameter with a String that matches the name of the
>>> ETLGroup it works. E.G.
>>> createQuery("sql", "SELECT CDO_ID FROM ETLGroup etl WHERE name =
>>> :name") ;
>>> So how come it does not work for my UUID object?
>>>
>>> Thx.
>>>
>>> David
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Re: [CDO] Cannot pass object as parameter into cdoquery [message #714773 is a reply to message #714629] |
Thu, 11 August 2011 13:06 |
David Wynter Messages: 4624 Registered: July 2009 |
Senior Member |
|
|
Hi,
I could use 2 long parameters except isn't the ability to navigate to
etl.UUID.msb and et.UUID.lsb, this ability is specific to hql type only?
The second form of using UUID as a string form would only work if CDO
stored that, from my reading of the documents it stores internal
reference the UUID object, which itself stores the msb and lsb so our
generated refId thar uses hexadecimal characters to encode the msb and
lsb is not stored anywhere.
So my model is ETLGroup had a field called UUIS, an object that has 2
fields lsb and msb, which as Long. I have a refId from which I can
create a shiny new UUID and from that get the lsb and msb. So if there
is a way of using sql type syntax with the msb and lsb that would be
great. The CDO docs don't really show this except for those using hql.
Thx.
David
On 11/08/11 07:29, Eike Stepper wrote:
> Am 10.08.2011 22:29, schrieb David Wynter:
>> Hi,
>>
>> Maybe not quite the same. What I need to do is take the refId we have
>> for a UUID we store in a BPMN2 workflow xml and get CDO to retrieve
>> the actual object in the repo we have for where this UUID matches that
>> of the one in the repo. What we do is take this String representation
>> and create a new UUID object, this is what I am using in the query. We
>> only have sql, we did not use hql because there are limitations. If we
>> had hql I suppose we could do something like
>>
>> createQuery("sql", "SELECT CDO_ID FROM
>> ETLGroup etl WHERE etl.UUID.msb = :msb AND etl.UUID.lsb = :lsb") ;
>> where we get the lsb Long and the msb Long from the UUID we have created.
>>
>> How should we go about that given we only have sql and our objects are
>> all uniquely identified by the UUID objects?
> I must be misunderstanding something. Why isn't it sufficient to either
> set one query parameter to s string form of your UUID or two parameters
> to the two long values?
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>>
>> Thx.
>>
>> David
>>
>> On 10/08/11 16:35, Eike Stepper wrote:
>>> Hi David,
>>>
>>> That sounds like RFE 259330: [Query] Support transient objects to be
>>> passed between client <-> server,
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=259330
>>>
>>> Note that there has been no progress on it since almost 3 years.
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://www.esc-net.de
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>>>
>>> Am 10.08.2011 16:24, schrieb David Wynter:
>>>> Hi,
>>>>
>>>> I am using the sql syntax for my query language in CDO 3.0
>>>>
>>>> I tried this
>>>>
>>>> UUID etlGrpUUID = (UUID)workItem.getParameter("ETLGroup UUID");
>>>> CDOSession sess = EDMCDOSession.getSession();
>>>> CDOTransaction transaction = sess.openTransaction();
>>>>
>>>> CDOQuery cdoq = transaction.createQuery("sql", "SELECT CDO_ID FROM
>>>> ETLGroup WHERE UUID = :etlGrpUUID") ;
>>>> cdoq.setParameter("uuid", etlGrpUUID);
>>>> List<ETLGroup> result = cdoq.getResult(ETLGroup.class);
>>>>
>>>> I get
>>>>
>>>> Caused by: java.lang.UnsupportedOperationException: Object not
>>>> persisted
>>>> at
>>>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.adapt(CDOQueryImpl.java:143)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.createQueryInfo(CDOQueryImpl.java:129)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.createQueryResult(CDOQueryImpl.java:66)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.getResult(CDOQueryImpl.java:77)
>>>>
>>>>
>>>> at
>>>> com.yambina.edm.edmengine.workitems.ETLGroupWorkItemHandler.executeWorkItem(ETLGroupWorkItemHandler.java:39)
>>>>
>>>>
>>>>
>>>>
>>>> If I replace the parameter with a String that matches the name of the
>>>> ETLGroup it works. E.G.
>>>> createQuery("sql", "SELECT CDO_ID FROM ETLGroup etl WHERE name =
>>>> :name") ;
>>>> So how come it does not work for my UUID object?
>>>>
>>>> Thx.
>>>>
>>>> David
>>
|
|
|
Re: [CDO] Cannot pass object as parameter into cdoquery [message #715088 is a reply to message #714629] |
Fri, 12 August 2011 10:20 |
David Wynter Messages: 4624 Registered: July 2009 |
Senior Member |
|
|
Hi,
This works
SELECT CDO_ID FROM ETLGroup WHERE EXISTS (SELECT * FROM UUID WHERE msb =
:msb AND lsb = :lsb AND ETLGroup.UUID = UUID.CDO_ID)
You just need to look at the internal database structures to be able to
query successfully with sql.
Thx.
David
On 11/08/11 07:29, Eike Stepper wrote:
> Am 10.08.2011 22:29, schrieb David Wynter:
>> Hi,
>>
>> Maybe not quite the same. What I need to do is take the refId we have
>> for a UUID we store in a BPMN2 workflow xml and get CDO to retrieve
>> the actual object in the repo we have for where this UUID matches that
>> of the one in the repo. What we do is take this String representation
>> and create a new UUID object, this is what I am using in the query. We
>> only have sql, we did not use hql because there are limitations. If we
>> had hql I suppose we could do something like
>>
>> createQuery("sql", "SELECT CDO_ID FROM
>> ETLGroup etl WHERE etl.UUID.msb = :msb AND etl.UUID.lsb = :lsb") ;
>> where we get the lsb Long and the msb Long from the UUID we have created.
>>
>> How should we go about that given we only have sql and our objects are
>> all uniquely identified by the UUID objects?
> I must be misunderstanding something. Why isn't it sufficient to either
> set one query parameter to s string form of your UUID or two parameters
> to the two long values?
>
> Cheers
> /Eike
>
> ----
> http://www.esc-net.de
> http://thegordian.blogspot.com
> http://twitter.com/eikestepper
>
>
>>
>> Thx.
>>
>> David
>>
>> On 10/08/11 16:35, Eike Stepper wrote:
>>> Hi David,
>>>
>>> That sounds like RFE 259330: [Query] Support transient objects to be
>>> passed between client <-> server,
>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=259330
>>>
>>> Note that there has been no progress on it since almost 3 years.
>>>
>>> Cheers
>>> /Eike
>>>
>>> ----
>>> http://www.esc-net.de
>>> http://thegordian.blogspot.com
>>> http://twitter.com/eikestepper
>>>
>>>
>>>
>>> Am 10.08.2011 16:24, schrieb David Wynter:
>>>> Hi,
>>>>
>>>> I am using the sql syntax for my query language in CDO 3.0
>>>>
>>>> I tried this
>>>>
>>>> UUID etlGrpUUID = (UUID)workItem.getParameter("ETLGroup UUID");
>>>> CDOSession sess = EDMCDOSession.getSession();
>>>> CDOTransaction transaction = sess.openTransaction();
>>>>
>>>> CDOQuery cdoq = transaction.createQuery("sql", "SELECT CDO_ID FROM
>>>> ETLGroup WHERE UUID = :etlGrpUUID") ;
>>>> cdoq.setParameter("uuid", etlGrpUUID);
>>>> List<ETLGroup> result = cdoq.getResult(ETLGroup.class);
>>>>
>>>> I get
>>>>
>>>> Caused by: java.lang.UnsupportedOperationException: Object not
>>>> persisted
>>>> at
>>>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.adapt(CDOQueryImpl.java:143)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.createQueryInfo(CDOQueryImpl.java:129)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.createQueryResult(CDOQueryImpl.java:66)
>>>>
>>>>
>>>> at
>>>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.getResult(CDOQueryImpl.java:77)
>>>>
>>>>
>>>> at
>>>> com.yambina.edm.edmengine.workitems.ETLGroupWorkItemHandler.executeWorkItem(ETLGroupWorkItemHandler.java:39)
>>>>
>>>>
>>>>
>>>>
>>>> If I replace the parameter with a String that matches the name of the
>>>> ETLGroup it works. E.G.
>>>> createQuery("sql", "SELECT CDO_ID FROM ETLGroup etl WHERE name =
>>>> :name") ;
>>>> So how come it does not work for my UUID object?
>>>>
>>>> Thx.
>>>>
>>>> David
>>
|
|
|
Re: [CDO] Cannot pass object as parameter into cdoquery [message #715957 is a reply to message #715088] |
Tue, 16 August 2011 05:46 |
|
Am 12.08.2011 12:20, schrieb David Wynter:
> Hi,
>
> This works
>
> SELECT CDO_ID FROM ETLGroup WHERE EXISTS (SELECT * FROM UUID WHERE msb = :msb AND lsb = :lsb AND ETLGroup.UUID =
> UUID.CDO_ID)
>
> You just need to look at the internal database structures to be able to query successfully with sql.
Indeed. CDO ships with a small HTTP server called CDOServerBrowser that can display various server infos (incl. all DB
tables if used with DBStore). The default CDOServerApplication starts it if the system property
org.eclipse.emf.cdo.server.browser.port is set to, e.g., 7777.
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
>
> Thx.
>
> David
>
>
> On 11/08/11 07:29, Eike Stepper wrote:
>> Am 10.08.2011 22:29, schrieb David Wynter:
>>> Hi,
>>>
>>> Maybe not quite the same. What I need to do is take the refId we have
>>> for a UUID we store in a BPMN2 workflow xml and get CDO to retrieve
>>> the actual object in the repo we have for where this UUID matches that
>>> of the one in the repo. What we do is take this String representation
>>> and create a new UUID object, this is what I am using in the query. We
>>> only have sql, we did not use hql because there are limitations. If we
>>> had hql I suppose we could do something like
>>>
>>> createQuery("sql", "SELECT CDO_ID FROM
>>> ETLGroup etl WHERE etl.UUID.msb = :msb AND etl.UUID.lsb = :lsb") ;
>>> where we get the lsb Long and the msb Long from the UUID we have created.
>>>
>>> How should we go about that given we only have sql and our objects are
>>> all uniquely identified by the UUID objects?
>> I must be misunderstanding something. Why isn't it sufficient to either
>> set one query parameter to s string form of your UUID or two parameters
>> to the two long values?
>>
>> Cheers
>> /Eike
>>
>> ----
>> http://www.esc-net.de
>> http://thegordian.blogspot.com
>> http://twitter.com/eikestepper
>>
>>
>>>
>>> Thx.
>>>
>>> David
>>>
>>> On 10/08/11 16:35, Eike Stepper wrote:
>>>> Hi David,
>>>>
>>>> That sounds like RFE 259330: [Query] Support transient objects to be
>>>> passed between client <-> server,
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=259330
>>>>
>>>> Note that there has been no progress on it since almost 3 years.
>>>>
>>>> Cheers
>>>> /Eike
>>>>
>>>> ----
>>>> http://www.esc-net.de
>>>> http://thegordian.blogspot.com
>>>> http://twitter.com/eikestepper
>>>>
>>>>
>>>>
>>>> Am 10.08.2011 16:24, schrieb David Wynter:
>>>>> Hi,
>>>>>
>>>>> I am using the sql syntax for my query language in CDO 3.0
>>>>>
>>>>> I tried this
>>>>>
>>>>> UUID etlGrpUUID = (UUID)workItem.getParameter("ETLGroup UUID");
>>>>> CDOSession sess = EDMCDOSession.getSession();
>>>>> CDOTransaction transaction = sess.openTransaction();
>>>>>
>>>>> CDOQuery cdoq = transaction.createQuery("sql", "SELECT CDO_ID FROM
>>>>> ETLGroup WHERE UUID = :etlGrpUUID") ;
>>>>> cdoq.setParameter("uuid", etlGrpUUID);
>>>>> List<ETLGroup> result = cdoq.getResult(ETLGroup.class);
>>>>>
>>>>> I get
>>>>>
>>>>> Caused by: java.lang.UnsupportedOperationException: Object not
>>>>> persisted
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.adapt(CDOQueryImpl.java:143)
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.createQueryInfo(CDOQueryImpl.java:129)
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.createQueryResult(CDOQueryImpl.java:66)
>>>>>
>>>>>
>>>>> at
>>>>> org.eclipse.emf.internal.cdo.query.CDOQueryImpl.getResult(CDOQueryImpl.java:77)
>>>>>
>>>>>
>>>>> at
>>>>> com.yambina.edm.edmengine.workitems.ETLGroupWorkItemHandler.executeWorkItem(ETLGroupWorkItemHandler.java:39)
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> If I replace the parameter with a String that matches the name of the
>>>>> ETLGroup it works. E.G.
>>>>> createQuery("sql", "SELECT CDO_ID FROM ETLGroup etl WHERE name =
>>>>> :name") ;
>>>>> So how come it does not work for my UUID object?
>>>>>
>>>>> Thx.
>>>>>
>>>>> David
>>>
>
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Goto Forum:
Current Time: Fri Apr 19 14:50:52 GMT 2024
Powered by FUDForum. Page generated in 0.02201 seconds
|