.getBlobCol());
}
protected void runWithBlobSize(int sizeBytes) throws Exception {
// insert new clob
BlobTestEntity blobObj1 = ctxt.newObject(BlobTestEntity.class);
// init BLOB of a specified size
byte[] bytes = new byte[sizeBytes];
for (int i = 0; i < sizeBytes; i++) {
bytes[i] = (byte) (65 + (50 + i) % 50);
}
blobObj1.setBlobCol(bytes);
ctxt.commitChanges();
// read the CLOB in the new context
DataContext ctxt2 = createDataContext();
List objects2 = ctxt2.performQuery(new SelectQuery(BlobTestEntity.class));
assertEquals(1, objects2.size());
BlobTestEntity blobObj2 = (BlobTestEntity) objects2.get(0);
ByteArrayTypeTest.assertByteArraysEqual(blobObj1.getBlobCol(), blobObj2
.getBlobCol());
// update and save Clob
blobObj2.setBlobCol(new byte[] {
'1', '2'
});
ctxt2.commitChanges();
// read into yet another context and check for changes
DataContext ctxt3 = createDataContext();
List objects3 = ctxt3.performQuery(new SelectQuery(BlobTestEntity.class));
assertEquals(1, objects3.size());
BlobTestEntity blobObj3 = (BlobTestEntity) objects3.get(0);
ByteArrayTypeTest.assertByteArraysEqual(blobObj2.getBlobCol(), blobObj3
.getBlobCol());
}