Examples of ClobTypes


Examples of com.mysql.clusterj.jpatest.model.ClobTypes

        tx.begin();

        for (int i = 1; i < NUMBER_TO_INSERT; ++i) {
            // must be done with an active transaction
            ClobTypes e = em.find(ClobTypes.class, i);
            // see if it is the right one
            int actualId = e.getId();
            if (actualId != i) {
                error("Expected ClobTypes.id " + i + " but got " + actualId);
            }
            String string = e.getLarge10000();
            // make sure all fields were fetched properly
            checkString("before update", string, i, false);

            int position = getClobSizeFor(i)/2;
            // only update if the length is correct
            if (string.length() == (position * 2)) {
                StringBuilder sb = new StringBuilder(string);
                // modify the byte in the middle of the blob
                sb.replace(position, position + 1, "!");
                string = sb.toString();
                checkString("after update", string, i, true);
            }
            e.setLarge10000(string);
        }
        tx.commit();
        tx.begin();

        for (int i = 1; i < NUMBER_TO_INSERT; ++i) {
            // must be done with an active transaction
            ClobTypes e = em.find(ClobTypes.class, i);
            // see if it is the right one
            int actualId = e.getId();
            if (actualId != i) {
                error("Expected ClobTypes.id " + i + " but got " + actualId);
            }
            String string = e.getLarge10000();

            // check to see that the blob field has the right data
            checkString("after commit", string, i, true);
        }
        tx.commit();
View Full Code Here

Examples of com.mysql.clusterj.jpatest.model.ClobTypes

        tx.commit();
    }

    protected void createClobInstances(int number) {
        for (int i = 0; i < number; ++i) {
            ClobTypes instance = new ClobTypes();
            instance.setId(i);
            int length = getClobSizeFor(i);
            instance.setLarge10000(getString(length));
//            blob streams are not yet supported
//            instance.setBlobstream(getBlobStream(length));
            clobs.add(instance);
        }
    }
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.