openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Doug Reeder <reeder...@gmail.com>
Subject Re: Syntax and/or Settings for Join? ('Filter invalid' error)
Date Wed, 19 Nov 2008 04:15:28 GMT
Your second query works and is more elegant, but I'll need to use the  
first, because "o.countryCode LIKE :countryCode" is just a sample of a  
filter expression that involves an arbitrary number of terms connected  
by ANDs.  Thanks much!

I guess you have to think of Java-type expressions in a SQL-style  
statement.


On Nov 18, 2008, at 12:22 PM, Landers, Richard wrote:

>  I think you just need to compare
> SalesOrder with SalesOrder (not SalesOrder with SalesOrder.id).  That
> is, the expression "lic.salesOrder=o.id" would have to read
> "lic.salesOrder=o" because in EJB QL the expression "lic.salesOrder"
> refers to an object, not a column as in SQL.
>
> Also, you could let EJB QL do the join implicitly...
>
> 	SELECT  lic.productId, COUNT(lic)
> 	FROM  License lic
> 	WHERE  lic.salesOrder.countryCode LIKE :countryCode
> 	GROUP BY  lic.productId
>
> -- Rich Landers


Mime
View raw message