You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Evgeny Ryabitskiy (JIRA)" <ji...@apache.org> on 2009/09/23 21:03:15 UTC

[jira] Commented: (CAY-1279) Passing null values in query parameters

    [ https://issues.apache.org/jira/browse/CAY-1279?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12758831#action_12758831 ] 

Evgeny Ryabitskiy commented on CAY-1279:
----------------------------------------

After some investigation I found out this behavior for bind:

There are 3 cases of passing parameter to Cayenne:

1) Parameter is passed and it's not null.
2) Parameter is passed and it's null.
3) Parameter not passes.

And to cases for bind:

A) Simple bind without JDBC type: #bind($MyNullableParam)
B) Bind with JDBC type: #bind($MyNullableParam 'VARCHAR')

So... there is 6 cases:

A.1. Everything OK
A.2. Bind exception!
A.3. Bind exception!

B.1. Everything OK
B.2 Null passed! Everything Ok
B.3 Null passed! Everything Ok

So... I need every time to set JDBC type for bind.... If I want just null passing 
It's not cool...
And I think it's a bug... behavior in A should be same as in B 

> Passing null values in query parameters
> ---------------------------------------
>
>                 Key: CAY-1279
>                 URL: https://issues.apache.org/jira/browse/CAY-1279
>             Project: Cayenne
>          Issue Type: Bug
>          Components: Cayenne Core Library
>    Affects Versions: 1.2.5, 2.0.5, 3.0 beta 1, 3.0
>            Reporter: Evgeny Ryabitskiy
>            Priority: Blocker
>
> Example1:
> INSERT INTO TABLE1 (id, NullableColumn) values (10, $MyNullValue)
> If I put null in MyNullValue parameter I will get: bad formed query because of how Velocity do merge with templates.
> But Cayenne is using #bind directive, so....
> Example2:
> INSERT INTO TABLE1 (id, NullableColumn) values (10, #bind($MyNullValue))
> If I put null in MyNullValue parameter I will get Bind Exception.
> So.... how can I insert null in my column using Cayenne?!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.