Examples of ClobTestEntity


Examples of org.apache.cayenne.testdo.testmap.ClobTestEntity

        // read the CLOB in the new context
        List<?> objects2 = context2.performQuery(new SelectQuery(ClobTestEntity.class));
        assertEquals(1, objects2.size());

        ClobTestEntity clobObj2 = (ClobTestEntity) objects2.get(0);
        assertNull("Expected null, got: '" + clobObj2.getClobCol() + "'", clobObj2
                .getClobCol());

        // update and save Clob
        clobObj2.setClobCol("updated rather small clob...");
        context2.commitChanges();

        // read into yet another context and check for changes
        List<?> objects3 = context3.performQuery(new SelectQuery(ClobTestEntity.class));
        assertEquals(1, objects3.size());

        ClobTestEntity clobObj3 = (ClobTestEntity) objects3.get(0);
        assertEquals(clobObj2.getClobCol(), clobObj3.getClobCol());
    }
View Full Code Here

Examples of org.apache.cayenne.testdo.testmap.ClobTestEntity

        assertEquals(clobObj2.getClobCol(), clobObj3.getClobCol());
    }

    protected void runWithClobSize(int sizeBytes) throws Exception {
        // insert new clob
        ClobTestEntity clobObj1 = context.newObject(ClobTestEntity.class);

        // init CLOB of a specified size
        if (sizeBytes == 0) {
            clobObj1.setClobCol("");
        }
        else {
            byte[] bytes = new byte[sizeBytes];
            for (int i = 0; i < sizeBytes; i++) {
                bytes[i] = (byte) (65 + (50 + i) % 50);
            }
            clobObj1.setClobCol(new String(bytes));
        }

        context.commitChanges();

        // read the CLOB in the new context
        List<?> objects2 = context2.performQuery(new SelectQuery(ClobTestEntity.class));
        assertEquals(1, objects2.size());

        ClobTestEntity clobObj2 = (ClobTestEntity) objects2.get(0);
        assertEquals(clobObj1.getClobCol(), clobObj2.getClobCol());

        // update and save Clob
        clobObj2.setClobCol("updated rather small clob...");
        context2.commitChanges();

        // read into yet another context and check for changes
        List<?> objects3 = context3.performQuery(new SelectQuery(ClobTestEntity.class));
        assertEquals(1, objects3.size());

        ClobTestEntity clobObj3 = (ClobTestEntity) objects3.get(0);
        assertEquals(clobObj2.getClobCol(), clobObj3.getClobCol());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.