Package org.apache.ojb.otm.core

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


    private void createTestData() throws TransactionException, LockingException
    {
        for (int i = 0; i < COUNT; i++)
        {
            Transaction tx = _kit.getTransaction(_conn);
            tx.begin();
            Contract contract = new Contract();
            contract.setPk("C" + TIME);
            contract.setContractValue1("contractvalue1");
            contract.setContractValue2(1);
            contract.setContractValue3("contractvalue3");
View Full Code Here


            contract.setContractValue3("contractvalue3");
            contract.setContractValue4(new Timestamp(TIME));
            _conn.makePersistent(contract);
            tx.commit();
            tx = _kit.getTransaction(_conn);
            tx.begin();
            Version version = new Version();
            version.setPk("V" + TIME);
            version.setVersionValue1("versionvalue1");
            version.setVersionValue2(1);
            version.setVersionValue3(new Timestamp(TIME));
View Full Code Here

            version.setVersionValue3(new Timestamp(TIME));
            version.setContract(contract);
            _conn.makePersistent(version);
            tx.commit();
            tx = _kit.getTransaction(_conn);
            tx.begin();
            Effectiveness eff = new Effectiveness();
            eff.setPk("E" + TIME);
            eff.setEffValue1("effvalue1");
            eff.setEffValue2(1);
            eff.setEffValue3(new Timestamp(TIME));
View Full Code Here

        Iterator iter;
        /**
        * delete effectiveness first
        */
        Transaction tx = _kit.getTransaction(_conn);
        tx.begin();
        q = QueryFactory.newQuery(Effectiveness.class, crit);
        iter = _conn.getIteratorByQuery(q);
        while (iter.hasNext())
        {
            _conn.deletePersistent(iter.next());
View Full Code Here

        tx.commit();
        /**
        * then version
        */
        tx = _kit.getTransaction(_conn);
        tx.begin();
        q = QueryFactory.newQuery(Version.class, crit);
        iter = _conn.getIteratorByQuery(q);
        while (iter.hasNext())
        {
            _conn.deletePersistent(iter.next());
View Full Code Here

        tx.commit();
        /**
        * the contract
        */
        tx = _kit.getTransaction(_conn);
        tx.begin();
        q = QueryFactory.newQuery(Contract.class, crit);
        iter = _conn.getIteratorByQuery(q);
        while (iter.hasNext())
        {
            _conn.deletePersistent(iter.next());
View Full Code Here

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

        _conn.invalidateAll();
        /**
        * get A to make it and the related B in cache
        */
        tx = _kit.getTransaction(_conn);
        tx.begin();
        Identity oid = _conn.getIdentity(a);
        TestClassA a1 = (TestClassA) _conn.getObjectByIdentity(oid);
        assertTrue(a1.getB() != null);
        assertTrue(a1.getB().getValue1().equals("hi there"));
        /**
 
View Full Code Here

        /**
        * now get B and update it, do NOT get it by traversing A
        */
        tx = _kit.getTransaction(_conn);
        tx.begin();
        Identity boid = _conn.getIdentity(a.getB());
        TestClassB b1 = (TestClassB) _conn.getObjectByIdentity(boid);
        assertTrue(b1 != null);
        assertTrue(b1.getValue1().equals("hi there"));
        /**
 
View Full Code Here

        tx.commit();
        /**
        * make sure b was updated
        */
        tx = _kit.getTransaction(_conn);
        tx.begin();
        boid = _conn.getIdentity(a.getB());
        b1 = (TestClassB) _conn.getObjectByIdentity(boid);
        assertTrue(b1 != null);
        assertTrue(b1.getValue1().equals("goodbye there"));
        tx.commit();
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.