I've reduced the data map to just what was necessary to replicate the
problem and have opened a new Jira issue, CAY-1208. I wasn't sure about
the severity, so left it as major. If I hit these problem during
production development, they would be show-stoppers, but I'm only
evaluating.

Cheers,
Tony

-----Original Message-----
From: Andrus Adamchik [mailto:and...@objectstyle.org] 
Sent: Monday, 13 April 2009 10:19 p.m.
To: user@cayenne.apache.org
Subject: Re: General queries


> However, I wondered if it could cope with the first subselect and so
> ended up with this EJBQL query (accounting for different relationship
> names in Cayenne):
>
> select iosbu.toIosb.toIos, sum(iosbu.curQty)
>  from Iosbu as iosbu, Ios as ios
>  where iosbu.toIosb.toIosbs.id = 'A'
>    and (iosbu.toIosb.useByDt is null
>    or iosbu.toIosb.useByDt > CURRENT_DATE)
>  group by iosbu.toIosb.toIos
...
> SELECT t1.PART_CODE, SUM(t0.CUR_QTY) AS sc0 FROM IOSBU t0, INNER JOIN
> IOSB t1 ON (t0.IOSB_ID = t1.IOSB_ID) INNER JOIN IOSBS t3 ON
> (t1.IOSB_STAT = t3.IOSB_STAT) IOS t2 WHERE t3.IOSB_STAT = ? AND
> t1.USE_BY_DT IS NULL OR t1.USE_BY_DT > {fn CURDATE()} GROUP BY
> t1.PART_CODE
>
> Notice the "IOS t2" without a preceeding comma.

Looks like a bug. Care to open a Jira with this example?


> As I didn't need to specify Ios in the from clause, I took it out.  
> Then
> I got another problem. Note that selecting the relationship (ending in
> "toIos") results in Cayenne selecting the key for that related table
> (I'm assuming that Cayenne would subsequently use the key to retrieve
> the whole object) but it gets the type wrong. The key is a String but
> Cayenne seems to think it's a Long and tries to retrieve a Long from  
> the
> result set, which fails.

I guess I can comment on why this happened if you provide a sample  
DataMap that includes mapping of all these relationships. I won't  
exclude a possibility of a bug. So maybe you can attach a (subset of)  
DataMap to the Jira above and mention this problem as well.

Thanks,
Andrus







NOTICE - This message and any attached files may contain information that is 
confidential, legally privileged or proprietary.  It is intended only for use 
by the intended recipient. If you are not the intended recipient or the person 
responsible for delivering the message to the intended recipient, be advised 
that you have received this message in error. Any dissemination, copying, use 
or re-transmission of this message or attachment, or the disclosure of any 
information therein, is strictly forbidden. BlueScope Steel Limited does not 
represent or guarantee that this message or attachment is free of errors, virus 
or interference. 
   
If you have received this message in error please notify the sender immediately 
and delete the message.  Any views expressed in this email are not necessarily 
the views of BlueScope Steel Limited.

Reply via email to