public void testStoreBlob() {
OpenJPAEntityManager pm;
pm = getPM(false, false);
startTx(pm);
BlobTest blob = new BlobTest();
byte[] bytes = new byte[2048];
for (int i = 0; i < bytes.length; i++)
bytes[i] = randomByte().byteValue();
blob.setBlob(bytes);
pm.persist(blob);
int id = blob.getId();
endTx(pm);
byte[] b1 = blob.getBlob();
endEm(pm);
pm = getPM(false, false);
startTx(pm);
BlobTest blob2 = pm.find(BlobTest.class, id);
byte[] b2 = blob2.getBlob();
assertNotNull("Original blob was null", b1);
assertNotNull("Retrieved blob was null", b2);
assertEquals("Blob length was not the same", b1.length, b2.length);
assertBytesEquals("Blob contents did not match", b1, b2);