Package org.apache.art

Examples of org.apache.art.BlobTestEntity


        // read the BLOB 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);
        assertNull(blobObj2.getBlobCol());

        // update and save Blob
        blobObj2.setBlobCol(bytes2);
        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());
    }
View Full Code Here


                .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());
    }
View Full Code Here

TOP

Related Classes of org.apache.art.BlobTestEntity

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.