You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by Benjamin <be...@wolterskluwer.com> on 2021/02/15 13:21:07 UTC

Insert with JDBC Thin driver into caches

Hi,

I have the following scenario:
1. I create a cache using the java API with a CacheConfiguration with a
QueryEntity<Key, Value> and some fields on it.
2. I put some data into that cache using SQL INSERT statements with the JDBC
Thin driver
3. I read this data using the java API with IgniteCache.get(Key)

If the fields on the QueryEntity are in the same order than the declared
fields of the Key class, everything works fine.

But if the fields on the QueryEntity are in a different order than the
declared field of the Key class, then I'm unable to read my data using
IgniteCache.get(Key) on step 3

The documentation says that the order of the fields on QueryEntity defines
the order of the returned columns for select * statements. But it says
nothing about inserts.
Am I missing something, or is this correct behavior?

I've attached a main(String[]) that reproduces the issue:  Main.java
<http://apache-ignite-users.70518.x6.nabble.com/file/t2439/Main.java>  
I'm using Ignite 2.9.1

Regards,

Benjamin





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

Re: Insert with JDBC Thin driver into caches

Posted by Ilya Kazakov <ka...@gmail.com>.
It is marked as deprecated because there were plans to make it enabled by
default. But it is still not...

Now the property is already deprecated, but the feature is still disabled
by default.

--------------
Thanks

вт, 16 февр. 2021 г. в 20:06, Benjamin <be...@wolterskluwer.com>:

> Thanks. It fixes the issue.
>
> However, the javadoc for
> IgniteSystemProperties.IGNITE_BINARY_SORT_OBJECT_FIELDS says:
>
> @deprecated Should be removed in Apache Ignite 2.0.
>
> Is it ok to use it? Does it have any other impact?
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>

Re: Insert with JDBC Thin driver into caches

Posted by Benjamin <be...@wolterskluwer.com>.
Thanks. It fixes the issue.

However, the javadoc for
IgniteSystemProperties.IGNITE_BINARY_SORT_OBJECT_FIELDS says:

@deprecated Should be removed in Apache Ignite 2.0.

Is it ok to use it? Does it have any other impact?



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

Re: Insert with JDBC Thin driver into caches

Posted by Ilya Kazakov <ka...@gmail.com>.
But this property should be set on the empty cluster before you create your
schema

-----------------------------
Ilya

вт, 16 февр. 2021 г. в 16:53, Ilya Kazakov <ka...@gmail.com>:

> Hello, Benjamin!
>
> Try to run your Ignite with system property: -DIGNITE_BINARY_SORT_OBJECT_FIELDS=true
>
> Or from Java:
>
> public static void main(String[] args) throws SQLException {
>
>     System.setProperty("IGNITE_BINARY_SORT_OBJECT_FIELDS", "true");
>
> ...
> -------------------------------------
> Thanks, Ilya!
>
> пн, 15 февр. 2021 г. в 21:21, Benjamin <benjamin.garaude@wolterskluwer.com
> >:
>
>> Hi,
>>
>> I have the following scenario:
>> 1. I create a cache using the java API with a CacheConfiguration with a
>> QueryEntity<Key, Value> and some fields on it.
>> 2. I put some data into that cache using SQL INSERT statements with the
>> JDBC
>> Thin driver
>> 3. I read this data using the java API with IgniteCache.get(Key)
>>
>> If the fields on the QueryEntity are in the same order than the declared
>> fields of the Key class, everything works fine.
>>
>> But if the fields on the QueryEntity are in a different order than the
>> declared field of the Key class, then I'm unable to read my data using
>> IgniteCache.get(Key) on step 3
>>
>> The documentation says that the order of the fields on QueryEntity defines
>> the order of the returned columns for select * statements. But it says
>> nothing about inserts.
>> Am I missing something, or is this correct behavior?
>>
>> I've attached a main(String[]) that reproduces the issue:  Main.java
>> <http://apache-ignite-users.70518.x6.nabble.com/file/t2439/Main.java>
>> I'm using Ignite 2.9.1
>>
>> Regards,
>>
>> Benjamin
>>
>>
>>
>>
>>
>> --
>> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>>
>

Re: Insert with JDBC Thin driver into caches

Posted by Ilya Kazakov <ka...@gmail.com>.
Hello, Benjamin!

Try to run your Ignite with system property:
-DIGNITE_BINARY_SORT_OBJECT_FIELDS=true

Or from Java:

public static void main(String[] args) throws SQLException {

    System.setProperty("IGNITE_BINARY_SORT_OBJECT_FIELDS", "true");

...
-------------------------------------
Thanks, Ilya!

пн, 15 февр. 2021 г. в 21:21, Benjamin <be...@wolterskluwer.com>:

> Hi,
>
> I have the following scenario:
> 1. I create a cache using the java API with a CacheConfiguration with a
> QueryEntity<Key, Value> and some fields on it.
> 2. I put some data into that cache using SQL INSERT statements with the
> JDBC
> Thin driver
> 3. I read this data using the java API with IgniteCache.get(Key)
>
> If the fields on the QueryEntity are in the same order than the declared
> fields of the Key class, everything works fine.
>
> But if the fields on the QueryEntity are in a different order than the
> declared field of the Key class, then I'm unable to read my data using
> IgniteCache.get(Key) on step 3
>
> The documentation says that the order of the fields on QueryEntity defines
> the order of the returned columns for select * statements. But it says
> nothing about inserts.
> Am I missing something, or is this correct behavior?
>
> I've attached a main(String[]) that reproduces the issue:  Main.java
> <http://apache-ignite-users.70518.x6.nabble.com/file/t2439/Main.java>
> I'm using Ignite 2.9.1
>
> Regards,
>
> Benjamin
>
>
>
>
>
> --
> Sent from: http://apache-ignite-users.70518.x6.nabble.com/
>