Package org.apache.ojb.broker

Examples of org.apache.ojb.broker.Identity


            pg.setName("1");
            _conn.makePersistent(pg);

            tx.commit();

            Identity oid = _conn.getIdentity(pg);

            // get from the database
            tx = _kit.getTransaction(_conn);
            tx.begin();
            _conn.invalidate(oid);
View Full Code Here


            pg.add(article);
            article.setProductGroup(pg);
            _conn.makePersistent(article);
            tx.commit();

            Identity aOid = _conn.getIdentity(article);
            Identity pgOid = _conn.getIdentity(pg);

            tx = _kit.getTransaction(_conn);
            tx.begin();
            pg = (ProductGroup) _conn.getObjectByIdentity(pgOid);
            pg.setName("2");
View Full Code Here

            pg.setId(77777);
            pg.setName("1");
            _conn.makePersistent(pg);
            tx.commit();

            Identity pgOid = _conn.getIdentity(pg);

            tx = _kit.getTransaction(_conn);
            tx.begin();
            pg = (ProductGroup) _conn.getObjectByIdentity(pgOid);
            pg.setName("2");
View Full Code Here

        Transaction tx = null;
        Transaction tx2 = null;
        OTMConnection conn2;
        ProductGroup pg = null;
        ProductGroup pg2 = null;
        Identity pOid = null;
        Identity pOid2 = null;

        conn2 = _kit.acquireConnection(PersistenceBrokerFactory.getDefaultKey());

        try
        {
            tx = _kit.getTransaction(_conn);
            tx.begin();
            pg = new ProductGroup();
            pg.setId(77777);
            pg.setName("1");
            pOid = _conn.getIdentity(pg);
            if (_conn.getObjectByIdentity(pOid) == null)
            {
                _conn.makePersistent(pg);
            }
            pg2 = new ProductGroup();
            pg2.setId(77778);
            pg2.setName("1");
            pOid2 = _conn.getIdentity(pg2);
            if (_conn.getObjectByIdentity(pOid2) == null)
            {
                _conn.makePersistent(pg2);
            }
            tx.commit();

            final Identity pgOid = _conn.getIdentity(pg);
            final Identity pgOid2 = _conn.getIdentity(pg2);


            final Transaction tx3 = _kit.getTransaction(_conn);
            tx3.begin();
            _conn.getObjectByIdentity(pgOid, LockType.WRITE_LOCK);
View Full Code Here

        ProductGroup pg;
        Article article;
        Article article2;
        org.apache.ojb.broker.Person person;
        org.apache.ojb.broker.Project project;
        Identity aOid = null;
        Identity aOid2 = null;
        Identity pgOid = null;
        Identity prsOid = null;
        Identity prjOid = null;

        //perform transaction
        try
        {
            tx = _kit.getTransaction(_conn);
View Full Code Here

            // cross check with PersistenceBroker lookup
            // 1. get OID
            Article example = new Article();
            example.setArticleId(60);
            Identity oid = new Identity(example, ((TransactionImpl) tx).getBroker());
            // 2. lookup object by OID
            PersistenceBroker broker = ((TransactionImpl) tx).getBroker();
            broker.clearCache();
            Article b = (Article) broker.getObjectByIdentity(oid);
View Full Code Here

            //crosscheck with PersistenceBroker lookup
            // 1. get OID
            Article example = new Article();
            example.setArticleId(30);
            Identity oid = new Identity(example, ((TransactionImpl) tx).getBroker());

            // 2. lookup object by OID
            PersistenceBroker broker = ((TransactionImpl) tx).getBroker();
            broker.clearCache();
            Article b = (Article) broker.getObjectByIdentity(oid);
View Full Code Here

            throws Exception
    {
        Master master = new Master();
        master.masterText = "Master_timestamp_" + timestamp;
        master.collDetailFKnoPK = new Vector();
        new Identity(master, ((HasBroker) tx).getBroker());
        for (int i = 0; i < countDetailObjects; i++)
        {
            DetailFKnoPK aDetail = new DetailFKnoPK();
            aDetail.detailText = "DetailFK*no*PK count " + i + ", associate master " + master.masterId + " timestamp_" + timestamp;
            aDetail.master = master;
View Full Code Here

            throws Exception
    {
        Master master = new Master();
        master.masterText = "Master_timestamp_" + timestamp;
        master.collDetailFKinPK = new Vector();
        new Identity(master, ((HasBroker) tx).getBroker());
        for (int i = 0; i < countDetailObjects; i++)
        {
            DetailFKinPK aDetail = new DetailFKinPK();
            aDetail.detailText = "DetailFKinPK count " + i + ", associate master " + master.masterId + " timestamp_" + timestamp;
            aDetail.master = master;
View Full Code Here

        database.makePersistent(em1);
        database.makePersistent(m1);
        tx.commit();

        tx.begin();
        Identity m1_oid = new Identity(m1, tx.getBroker());
        Identity ex1_oid = new Identity(ex1, tx.getBroker());
        Identity em1_oid = new Identity(em1, tx.getBroker());

        tx.getBroker().clearCache();

        Employee newEm1 = (Employee) tx.getBroker().getObjectByIdentity(em1_oid);
        Executive newEx1 = (Executive) tx.getBroker().getObjectByIdentity(ex1_oid);
View Full Code Here

TOP

Related Classes of org.apache.ojb.broker.Identity

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.