Doug, I'm pretty new at this myself, but 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 -----Original Message----- From: Dan Nimtz [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 18, 2008 10:46 AM To: users@openjpa.apache.org Subject: Re: Syntax and/or Settings for Join? ('Filter invalid' error) Doug, Not sure about the error, and likely isn't what your are looking for, but here's a section of the user's guide regarding the openjpa.Compatibility property http://openjpa.apache.org/builds/latest/docs/manual/manual.html#openjpa. Compatibility 5.6. openjpa.Compatibility *Property name: *openjpa.Compatibility *Configuration API:* org.apache.openjpa.conf.OpenJPAConfiguration.getCompatibility<http://ope njpa.apache.org/builds/latest/docs/javadoc/org/apache/openjpa/conf/OpenJ PAConfiguration.html#getCompatibility%28%29> *Resource adaptor config-property: * Compatibility *Default:* - *Description:* Encapsulates options to mimic the behavior of previous OpenJPA releases. - Dan Nimtz On Tue, Nov 18, 2008 at 3:52 AM, Doug Reeder <[EMAIL PROTECTED]> wrote: > I've added a JPA query to my application which does a simple join: > SELECT lic.productId, COUNT(lic) FROM License lic, SalesOrder o WHERE > lic.salesOrder=o.id AND o.countryCode LIKE :countryCode GROUP BY > lic.productId > > where SalesOrder and License are defined > > @Entity(name = "SalesOrder") > @Table(name = "SALESORDER") > public class SalesOrder implements Serializable { > > @Id > @GeneratedValue(strategy = GenerationType.AUTO) > @Column(name = "ORDERID") > private long id; > > @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, > mappedBy = "salesOrder") > private Collection<License> licenses = new ArrayList<License>(); . > . > . > } > > @Entity > @Table(name="LICENSE") > public class License implements Serializable { > @Id > @GeneratedValue(strategy = GenerationType.AUTO) > @Column(name = "ID") > private Long id; > > @ManyToOne() > @JoinColumn(name="SALESORDER") > private SalesOrder salesOrder; > . > . > . > } > > but this fails with the error: > > Filter invalid. Cannot compare field salesOrder of type softbiz.SalesOrder to field id of type long. Numeric comparisons must be between numeric types only. To enable such comparisons for backwards-compatibility, add "QuotedNumbersInQueries=true" to the org.apache.openjpa.Compatibility setting in your configuration. > > > This query works fine with GlassFish+TopLink, but fails under > Geroniomo > 2.1.3 + OpenJPA 1.0.3. Both are running under Java 1.5.0_16 (32-bit) > running under Mac OS 10.5.5 on a 64-bit intel processor (Core2). > > > The page > > http://openjpa.apache.org/builds/1.0.2/apache-openjpa-1.0.2/docs/manua > l/ref_guide_dbsetup_sql92.html seems to be addressing something > different from the error message, which is confusing. > > > What is the best way to do the join? If I indeed need to set > "QuotedNumbersInQueries=true", where should I do this in the > Geronimo+OpenJPA configuration files? I've grepped for > "org.apache.openjpa.Compatibility" and can't find it. >