openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Craig L Russell <Craig.Russ...@Sun.COM>
Subject Re: Bad Derby query
Date Tue, 03 Apr 2007 03:06:26 GMT
Hi Dain,

I've seen this problem as well, with a different provider. The JPA  
spec lead sez that "?1 IS NULL" is not a portable JPAQL query, even  
though some providers can generate SQL that some databases can  
execute properly.

It might not be an easy issue for OpenJPA to fix. How easy is it for  
you to generate a different query?

Craig

On Apr 2, 2007, at 5:27 PM, Dain Sundstrom wrote:

> I have the following query:
>
> 	SELECT a.alias FROM AliasBean AS a WHERE (a.alias IS NULL AND ?1  
> IS NULL) OR a.alias = ?1
>
> Which works great when run against HSQLDB.  When I switch the  
> database to Derby I get the following exception:
>
> <0|false|0.9.6-incubating>  
> org.apache.openjpa.persistence.PersistenceException: Syntax error:  
> Encountered "NULL" at line 1, column 68. {SELECT t0.ALIAS FROM  
> ALIASEJB_TABLE t0 WHERE (t0.ALIAS IS NULL AND NULL IS NULL OR  
> t0.ALIAS IS NULL)} [code=20000, state=42X01]
>
> Now my code is setting the parameter to NULL but that should be  
> valid.  Any idea what is going on?  Also, I'm using 0.9.6 so is  
> this a known problem?
>
> Thanks,
>
> -dain

Craig Russell
Architect, Sun Java Enterprise System http://java.sun.com/products/jdo
408 276-5638 mailto:Craig.Russell@sun.com
P.S. A good JDO? O, Gasp!


Mime
View raw message