Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] Cannot pass null parameter

Thanks for the link.

EclipseLink should be able to figure out what to do without queryHint
in case where NULL is explicitely coded in the JPQL as in

SELECT a FROM Author a WHERE :lastName IS NULL OR LOWER(a.lastName) =
:lastName

Kind Regards,

Bernard


On Mon, 31 Oct 2011 14:10:56 -0400, you wrote:

>This looks similar to 
>https://bugs.eclipse.org/bugs/show_bug.cgi?id=258221 where it is 
>suggested you need to use the queryHint "eclipselink.prepare" with a 
>value of false so that the query is reprocessed when the null value is 
>passed in.
>
>Best Regards,
>Chris
>
>
>On 31/10/2011 1:35 PM, bht@xxxxxxxxxxxxx wrote:
>> Hi Tom,
>>
>> In principle, I don't want to suggest any constraints on what SQL
>> EclipseLink should produce. The examples at
>>
>> http://en.wikipedia.org/wiki/Java_Persistence_Query_Language#Examples
>>
>> contain a compact JPQL as follows
>>
>> SELECT a FROM Author a WHERE :lastName IS NULL OR LOWER(a.lastName) =
>> :lastName
>>
>> which I have used successfully with OpenJPA in other projects.
>>
>> This type of query is very useful especially when expanded for
>> querying a large number of fields with only a sub-set of user-supplied
>> values, without having to generate the query in code which is a lot of
>> work and risky, or even more work but less risky when using the
>> criteria API.
>>
>> In
>>
>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=362414
>>
>> I plugged in OpenJPA with the following persistence.xml modifications:
>>
>> <property name="openjpa.Log" value="SQL=TRACE"/>
>> <property name="openjpa.jdbc.SynchronizeMappings"
>> value="buildSchema(SchemaAction=&apos;add,deleteTableContents&apos;,ForeignKeys=true)"/>
>>
>> and
>> -javaagent:openjpa-all-2.1.1.jar
>>
>> Their solution might not be EclipseLink's final solution, so
>> EclipseLink might in the end do something more intelligent - as long
>> as it works, that would be fine with me.
>>
>> The testcase is somewhat special because it queries related Region not
>> basic CustomerOrder so I should have added a basic case, too.
>>
>> Kind Regards,
>>
>> Bernard
>>
>>
>>
>>
>>
>> On Mon, 31 Oct 2011 08:27:52 -0400, you wrote:
>>
>>> Hi Bernard,
>>>
>>>    The exception you are getting is a SQLException.  That comes from your
>>> database, not EclipseLink.  What SQL are you expecting us to produce?
>>>
>>> -Tom
>>>
>>> On 29/10/2011 10:51 PM, bht@xxxxxxxxxxxxx wrote:
>>>> Hi,
>>>>
>>>> Please help me find a workaround for
>>>>
>>>> Cannot pass null in Parameter as Identification variable or Primitive
>>>> https://bugs.eclipse.org/bugs/show_bug.cgi?id=362414
>>>>
>>>> I am really perplexed because this seems to be quite basic. I made a
>>>> cross check - it works in OpenJPA.
>>>>
>>>> Thanks,
>>>>
>>>> Bernard
>>>>
>>>> _______________________________________________
>>>> eclipselink-users mailing list
>>>> eclipselink-users@xxxxxxxxxxx
>>>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>>> _______________________________________________
>>> eclipselink-users mailing list
>>> eclipselink-users@xxxxxxxxxxx
>>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
>> _______________________________________________
>> eclipselink-users mailing list
>> eclipselink-users@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/eclipselink-users



Back to the top