You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by the_palakkaran <ji...@suntecsbs.com> on 2018/05/08 05:56:31 UTC

IS NULL on Numeric Query SQL Fields

Hi,

int uniqueId;
int actNo;
String actId;
String somethingElse;

Now when I load values to the cache, if actNo is null in DB, then it will be
*loaded as 0* (zero being initial value)

So if I execute the below query as SQLFieldsQuery on cache, no rows would be
returned:
select somethingElse from Account where actNo * is null * and actId = ?;
(arguments will be passed as object array)

In hibernate we had the provision to mention parameter type so that it would
understand this scenario? Does ignite provide a way to resolve this ?

Thanks in advance.




--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: IS NULL on Numeric Query SQL Fields

Posted by the_palakkaran <ji...@suntecsbs.com>.
Thanks for the reply Pavel.

Actually I don't want to keep 0 in my java model. I just want some other way
around so that I can execute an is null query on a numeric field and get
rows returned if it was originally null in the DB.

I think I need to keep it as Wrapper type and do getObject() and then query
on it. 

Was checking for other alternatives.



--
Sent from: http://apache-ignite-users.70518.x6.nabble.com/

Re: IS NULL on Numeric Query SQL Fields

Posted by Pavel Vinokurov <vi...@gmail.com>.
Hi,

As I understand you would like to have null value in the database, but 0 in
the java model.
I suppose that most properly way is to just keep "Integer" field and modify
getter and setter to return 0 value.
Also  Ignite provides for [1]Binarylizable interface for customization of
the binary serialization. With that you could customize transformation for
the "int" field.

[1]
https://ignite.apache.org/releases/latest/javadoc/org/apache/ignite/binary/Binarylizable.html

Thanks,
Pavel


2018-05-08 8:56 GMT+03:00 the_palakkaran <ji...@suntecsbs.com>:

> Hi,
>
> int uniqueId;
> int actNo;
> String actId;
> String somethingElse;
>
> Now when I load values to the cache, if actNo is null in DB, then it will
> be
> *loaded as 0* (zero being initial value)
>
> So if I execute the below query as SQLFieldsQuery on cache, no rows would
> be
> returned:
> select somethingElse from Account where actNo * is null * and actId = ?;
> (arguments will be passed as object array)
>
> In hibernate we had the provision to mention parameter type so that it
> would
> understand this scenario? Does ignite provide a way to resolve this ?
>
> Thanks in advance.
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>



-- 

Regards

Pavel Vinokurov