Package org.apache.ojb.odmg

Examples of org.apache.ojb.odmg.TransactionImpl$CascadeSettingException


    public PBKey getPBKey()
    {
        if(pbKey == null)
        {
            TransactionImpl tx = getTransaction();
            if(tx != null && tx.isOpen())
            {
                pbKey = tx.getBroker().getPBKey();
            }
        }
        return pbKey;
    }
View Full Code Here


    public Object execute() throws org.odmg.QueryException
    {
        if (log.isDebugEnabled()) log.debug("Start execute query");

        //obtain current ODMG transaction
        TransactionImpl tx = odmg.getTxManager().getTransaction();
        // create PBCapsule
        PBCapsule capsule = null;
        ManageableCollection result = null;

        try
View Full Code Here

    public void add(int index, Object element)
    {
        DListEntry entry = prepareEntry(element);
        elements.add(index, entry);
        // if we are in a transaction: acquire locks !
        TransactionImpl tx = getTransaction();
        if (checkForOpenTransaction(tx))
        {
            RuntimeObject rt = new RuntimeObject(this, tx);
            List regList = tx.getRegistrationList();
            tx.lockAndRegister(rt, Transaction.WRITE, false, regList);

            rt = new RuntimeObject(element, tx);
            tx.lockAndRegister(rt, Transaction.READ, regList);

            rt = new RuntimeObject(entry, tx, true);
            tx.lockAndRegister(rt, Transaction.WRITE, false, regList);
        }

        // changing the position markers of entries:
        int offset = 0;
        try
View Full Code Here

     */
    public Object remove(int index)
    {
        DListEntry entry = (DListEntry) elements.get(index);
        // if we are in a transaction: acquire locks !
        TransactionImpl tx = getTransaction();
        if (checkForOpenTransaction(tx))
        {
            tx.deletePersistent(new RuntimeObject(entry, tx));
        }
        elements.remove(index);
        // changing the position markers of entries:
        int offset = 0;
        try
View Full Code Here

     */
    public DCollection query(String predicate) throws QueryInvalidException
    {
        // 1.build complete OQL statement
        String oql = "select all from java.lang.Object where " + predicate;
        TransactionImpl tx = getTransaction();
        if (tx == null) throw new QueryInvalidException("Need running transaction to do query");

        OQLQuery predicateQuery = tx.getImplementation().newOQLQuery();
        predicateQuery.create(oql);
        Query pQ = ((OQLQueryImpl) predicateQuery).getQuery();
        Criteria pCrit = pQ.getCriteria();

        PBCapsule handle = new PBCapsule(pbKey, tx);
View Full Code Here

        DMapEntry entry = prepareEntry(key, value);
        boolean ok = entries.add(entry);
        if (ok)
        {
            TransactionImpl tx = getTransaction();
            if ((tx != null) && (tx.isOpen()))
            {
                List regList = tx.getRegistrationList();
                RuntimeObject rt = new RuntimeObject(this, tx);
                tx.lockAndRegister(rt, Transaction.WRITE, false, regList);

                rt = new RuntimeObject(key, tx);
                tx.lockAndRegister(rt, Transaction.READ, regList);

                rt = new RuntimeObject(value, tx);
                tx.lockAndRegister(rt, Transaction.READ, regList);

                rt = new RuntimeObject(entry, tx, true);
                tx.lockAndRegister(rt, Transaction.WRITE, false, regList);
            }
            return null;
        }
        else
        {
View Full Code Here

        Object oldValue = null;
        if (correctEntry != null)
        {
            oldValue = correctEntry.getValue();
            i.remove();
            TransactionImpl tx = getTransaction();
            if ((tx != null) && (tx.isOpen()))
            {
                tx.deletePersistent(new RuntimeObject(correctEntry, tx));
            }
        }
        return oldValue;
    }
View Full Code Here

    public PBKey getPBKey()
    {
        if(pbKey == null)
        {
            TransactionImpl tx = getTransaction();
            if(tx != null && tx.isOpen())
            {
                pbKey = tx.getBroker().getPBKey();
            }
        }
        return pbKey;
    }
View Full Code Here

        if (!this.contains(o))
        {
            DSetEntry entry = prepareEntry(o);
            elements.add(entry);
            // if we are in a transaction: get locks !
            TransactionImpl tx = getTransaction();
            if ((tx != null) && (tx.isOpen()))
            {
                List regList = tx.getRegistrationList();
                RuntimeObject rt = new RuntimeObject(this, tx);
                tx.lockAndRegister(rt, Transaction.WRITE, false, regList);

                rt = new RuntimeObject(o, tx);
                tx.lockAndRegister(rt, Transaction.READ, regList);

                rt = new RuntimeObject(entry, tx, true);
                tx.lockAndRegister(rt, Transaction.WRITE, false, regList);
            }
            return true;
        }
        else
        {
View Full Code Here

     */
    public DCollection query(String predicate) throws org.odmg.QueryInvalidException
    {
        // 1.build complete OQL statement
        String oql = "select all from java.lang.Object where " + predicate;
        TransactionImpl tx = getTransaction();

        OQLQuery predicateQuery = tx.getImplementation().newOQLQuery();

        PBCapsule capsule = new PBCapsule(tx.getImplementation().getCurrentPBKey(), tx);
        PersistenceBroker broker = capsule.getBroker();

        try
        {
            predicateQuery.create(oql);
View Full Code Here

TOP

Related Classes of org.apache.ojb.odmg.TransactionImpl$CascadeSettingException

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.