Package org.apache.ojb.otm.core

Examples of org.apache.ojb.otm.core.Transaction.begin()


            tx.commit();

            address.setStreet("newStreet");

            tx = _kit.getTransaction(_conn);
            tx.begin();
            address = (Address) _conn.getObjectByIdentity(oid, LockType.WRITE_LOCK);
            assertEquals("Cache was damaged.", "oldStreet", address.getStreet());
            tx.commit();

            address.setStreet("newStreet");
View Full Code Here


            tx.commit();

            address.setStreet("newStreet");

            tx = _kit.getTransaction(_conn);
            tx.begin();
            address = (Address) _conn.getObjectByIdentity(oid);
            assertEquals("Cache was damaged.", "oldStreet", address.getStreet());
            tx.commit();
        } catch (Throwable e) {
            if (tx != null) {
View Full Code Here

    private Collection getAddresses() throws Throwable {
        Transaction tx = null;
        Collection addresses;
        try {
            tx = _kit.getTransaction(_conn);
            tx.begin();
            _conn.invalidateAll();
            Query q = QueryFactory.newQuery(Address.class, (Criteria)null);
            addresses = _conn.getCollectionByQuery(q);
            tx.commit();
        } catch (Throwable e) {
View Full Code Here

            throws Throwable {
        Transaction tx = null;
        Collection oldAddresses;
        try {
            tx = _kit.getTransaction(_conn);
            tx.begin();

            Query q = QueryFactory.newQuery(Address.class, (Criteria)null);
            oldAddresses = _conn.getCollectionByQuery(q);

            Iterator oldAddressesIterator = oldAddresses.iterator();
View Full Code Here

    private Collection deleteAddresses(Collection oldAddresses)
            throws Throwable {
        Transaction tx = null;
        try {
            tx = _kit.getTransaction(_conn);
            tx.begin();

            Iterator oldAddressesIterator = oldAddresses.iterator();
            while (oldAddressesIterator.hasNext()) {
                Address oldAddress = (Address)oldAddressesIterator.next();
                _conn.deletePersistent(oldAddress);
View Full Code Here

    private void clearTestData() throws LockingException
    {
        TestClassA a = generateTestData();
        TestClassB b2 = generateAnotherB();
        Transaction tx = _kit.getTransaction(_conn);
        tx.begin();
        Identity oid = _conn.getIdentity(a);
        Identity oidb = _conn.getIdentity(a.getB());
        Identity oidb2 = _conn.getIdentity(b2);
        TestClassA a1 = (TestClassA) _conn.getObjectByIdentity(oid);
        if (a1 != null)
View Full Code Here

        /**
        * first get the contract object.
        */
        PersistenceBrokerFactory.defaultPersistenceBroker().clearCache();
        Transaction tx = _kit.getTransaction(_conn);
        tx.begin();
        Criteria crit = new Criteria();
        crit.addEqualTo("pk", "C" + TIME);
        Query q = QueryFactory.newQuery(Contract.class, crit);
        Iterator it = _conn.getIteratorByQuery(q, LockType.WRITE_LOCK);
        Object retval = null;
View Full Code Here

            ((Contract) retval).setRelatedToContract(r2c);
        }
        tx.commit();
        r2c = null;
        tx = _kit.getTransaction(_conn);
        tx.begin();
        crit = new Criteria();
        crit.addEqualTo("pk", "E" + TIME);
        q = QueryFactory.newQuery(Effectiveness.class, crit);
        it = _conn.getIteratorByQuery(q);
        retval = null;
View Full Code Here

   public void testSwizzle3() throws TransactionException, LockingException, PBFactoryException, PersistenceBrokerException
    {
        clearTestData();
        TestClassA a = generateTestData();
        Transaction tx = _kit.getTransaction(_conn);
        tx.begin();
        _conn.makePersistent(a.getB());
        _conn.makePersistent(a);
    TestClassB b = a.getB();
        tx.commit();
        /**
 
View Full Code Here

        /**
        * clear to start test
        */
        _conn.invalidateAll();
        tx = _kit.getTransaction(_conn);
        tx.begin();
        /**
     * load B
     */
    Identity oidb = _conn.getIdentity(b);
        TestClassB b1 = (TestClassB) _conn.getObjectByIdentity(oidb);
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.