[ 
https://issues.apache.org/jira/browse/IGNITE-7411?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Taras Ledkov resolved IGNITE-7411.
----------------------------------
    Resolution: Not A Bug

> JDBC thin client selects NULL cache ID values of entries added with Java API
> ----------------------------------------------------------------------------
>
>                 Key: IGNITE-7411
>                 URL: https://issues.apache.org/jira/browse/IGNITE-7411
>             Project: Ignite
>          Issue Type: Bug
>          Components: thin client
>    Affects Versions: 2.3
>            Reporter: Alexey Kukushkin
>            Priority: Critical
>         Attachments: Reproducer.java
>
>
> I am using SQL to create caches and run queries and DataStreamer to load lots 
> of data. I must use MD5 digests as entity IDs (BINARY(16) SQL type). The 
> problem is when I select data loaded with DataStreamer the fields 
> participating in PRIMARY KEY are null.
>  * Note: binary fields not part of primary keys are OK (not null)
>  * Note: if I use JAVA API even the binary primary key fields are OK (not 
> null).
> Reproducer below fails on the last assertion since SSN is NULL.
> See full reproducer code in branch ignite-7411 or use the reproducer attached.
> {code:java}
>     @Test
>     public void javaPutIntoSqlCacheWithBinaryAffinityKey() throws 
> SQLException {
>         try (Ignite srv = Ignition.start(getServerConfig());
>              Ignite cln = Ignition.start(getClientConfig());
>              Connection conn = 
> DriverManager.getConnection("jdbc:ignite:thin://127.0.0.1/")
>         ) {
>             conn.prepareStatement(
>                 "CREATE TABLE " + CACHE_NAME + "(" +
>                     "ssn BINARY(16), orgId BINARY(16), name BINARY(16), 
> PRIMARY KEY(ssn, orgId)" +
>                     ") WITH 
> \"affinitykey=orgId,value_type=org.apache.ignite.Reproducer$Person\""
>             ).execute();
>             IgniteCache<AffinityKey<byte[]>, Person> cache = 
> cln.cache("SQL_PUBLIC_" + CACHE_NAME);
>             AffinityKey<byte[]> key = new AffinityKey<>(new byte[] {1, 2}, 
> new byte[] {3, 4});
>             cache.put(key, new Person(key.key(), key.affinityKey(), new 
> byte[] {5, 6}));
>             List<Person> entries = convert(conn.prepareStatement("SELECT * 
> from " + CACHE_NAME).executeQuery());
>             assertEquals("1 person must be in the cache", 1, entries.size());
>             assertArrayEquals("Person SSN must be same as affinity key's 
> key", key.key(), entries.get(0).getSsn());
>         }
>     }
>     /** */
>     private List<Person> convert(ResultSet resSet) throws SQLException {
>         List<Person> res = new ArrayList<>();
>         while (resSet.next())
>             res.add(new Person(resSet.getBytes(1), resSet.getBytes(2), 
> resSet.getBytes(3)));
>         return res;
>     }
> {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to