MySQL Forums
Forum List  »  NDB clusters

Re: ClusterJ JSON field type mapping to Java Object
Posted by: Lakshmi Narayanan Sreethar
Date: July 25, 2019 07:54AM

ClusterJ doesn't have the proper support to handle JSON datatypes yet.

Internally the JSON columns are stored as blob columns. On an insert, MySQL Server validates the JSON value, appends some additional information about the JSON format to the value and then passes them to the storage engines as blobs. They are treated like any other blobs within the storage engine. And during reads, the MySQL Server Layer handles any JSON specific actions after reading the blobs from the Storage Engines.

Since ClusterJ connects directly with the storage engine(i.e. the data nodes), they identify these JSON columns as plain blob columns. So technically you can read and write from these columns using byte[] java dataype, as blobs are mapped to that. But JSON values written through ClusterJ will not be readable through MySQL Server as they will look for the additional JSON information in the blob during reads. And in the same way, JSON values written through MySQL Server might be unreadable from ClusterJ. If both reading and writing are done from ClusterJ, it should work. But then you don't need a JSON column for that - just a varchar would do.

Lakshmi Narayanan Sreethar
MySQL Cluster Developer

Edited 1 time(s). Last edit at 07/25/2019 10:28AM by Lakshmi Narayanan Sreethar.

Options: ReplyQuote

Written By
Re: ClusterJ JSON field type mapping to Java Object
July 25, 2019 07:54AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.