Errors saving to BLOB via ClusterJ
We are trying to have a cache table with serialized JSON stored as a zipped byte array:
CREATE TABLE `T_SUBSCRIBER_CACHE` (
`F_KEY` VARCHAR(255) NOT NULL,
`F_VALUE` BLOB NOT NULL,
`F_LASTMODIFY_TIME` timestamp DEFAULT NOW() ON UPDATE NOW() NOT NULL,
CONSTRAINT PK_SUBSCRIBER_CACHE PRIMARY KEY (`F_KEY`)
) ENGINE=NDB;
Entity
@PersistenceCapable(table="T_SUBSCRIBER_CACHE")
public interface SubscriberCache {
@PrimaryKey(name="PK_SUBSCRIBER_CACHE")
@Column(name="F_KEY")
String getKey();
void setKey(String key);
@Column(name="F_VALUE")
byte[] getValue();
void setValue(byte[] value);
}
When we try to save any data (and I verify the byte array is actually valid, it's not null) we get ClusterJ errors like this:
9-Mar-2012 10:18:08 AM com.mysql.clusterj.tie.Utility throwError
SEVERE: Error in NdbJTie: returnCode -1, code 4,209, mysqlCode -1, status 2, classification 1, message Length parameter in equal/setValue is incorrect .
[ERROR] 2012-03-09 10:18:08.860 com.mysql.clusterj.tie - Error in NdbJTie: returnCode -1, code 4,209, mysqlCode -1, status 2, classification 1, message Length parameter in equal/setValue is incorrect .
9-Mar-2012 10:18:08 AM com.mysql.clusterj.core.SessionImpl insert
SEVERE: Error executing getInsertOperation on table T_SUBSCRIBER_CACHE.
com.mysql.clusterj.ClusterJException: Error executing getInsertOperation on table T_SUBSCRIBER_CACHE. Caused by com.mysql.clusterj.ClusterJDatastoreException:For field value column F_VALUE valueDelegate setBytes, error executing setValue. Caused by com.mysql.clusterj.ClusterJDatastoreException:Error in NdbJTie: returnCode -1, code 4,209, mysqlCode -1, status 2, classification 1, message Length parameter in equal/setValue is incorrect .
at com.mysql.clusterj.core.SessionImpl.insert(SessionImpl.java:405) ~[clusterjpa-7.2.4.jar:na]
at com.mysql.clusterj.core.SessionImpl.makePersistent(SessionImpl.java:381) ~[clusterjpa-7.2.4.jar:na]
at com.mysql.clusterj.core.SessionImpl.persist(SessionImpl.java:1310) ~[clusterjpa-7.2.4.jar:na]
Is there a particular way to save byte[] into BLOB via ClusterJ? This works out of the box in regular Hibernate on Oracle, so we hoped it would be the same in ClusterJ.
Thanks
Jacek