By following exactly this question and the solution as well, I still cannot solve the problem. I still get " Data too long for column 'id' at row 1"
public static byte[] asBytes(UUID uuid) {
ByteBuffer bb = ByteBuffer.wrap(new byte[16]);
bb.putLong(uuid.getMostSignificantBits());
bb.putLong(uuid.getLeastSignificantBits());
return bb.array();
}
UUID id= UUID.randomUUID();
InsertQueryBuilder runner = new InsertQueryBuilder("test_table")
.addField("id", asBytes(id));
return getConnection()
.flatMap(connection -> runner.run(connection)
.doOnTerminate(connection::close))
From that answer I understood that 16 bytes is 32 hex digits. So If I change column type to BINARY (32), then I Don't get any error and id gets successfully written in DB.
I tried to keep the ByteBuffer bb size to 8, but then I get;
BufferOverflowException
What am I missing?