openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dan Nimtz" <dnimtz...@gmail.com>
Subject Re: Syntax and/or Settings for Join? ('Filter invalid' error)
Date Tue, 18 Nov 2008 15:46:18 GMT
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://openjpa.apache.org/builds/latest/docs/javadoc/org/apache/openjpa/conf/OpenJPAConfiguration.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 <reeder.29@gmail.com> 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/manual/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.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message