Package org.apache.ojb.broker.util

Examples of org.apache.ojb.broker.util.BrokerHelper


                    m_objectsTopLevelClass = targetBroker.getTopLevelClass(objectToIdentify.getClass());
                    m_objectsRealClass = objectToIdentify.getClass();

                    // BRJ: definitely do NOT convertToSql
                    // conversion is done when binding the sql-statement
                    final BrokerHelper helper = targetBroker.serviceBrokerHelper();
                    final ValueContainer[] pkValues = helper.getValuesForObject(cld.getPkFields(), objectToIdentify, false, true);
                    if (pkValues == null || pkValues.length == 0)
                    {
                        throw createException("Can't extract PK value fields", objectToIdentify, null);
                    }
                    m_pkValues = helper.extractValueArray(pkValues);
                }
            }

            checkForPrimaryKeys(objectToIdentify);
        }
View Full Code Here


     */
    protected Query[] buildPrefetchQueries(Collection owners, Collection children)
    {
        ClassDescriptor cld = getOwnerClassDescriptor();
        Class topLevelClass = getBroker().getTopLevelClass(cld.getClassOfObject());
        BrokerHelper helper = getBroker().serviceBrokerHelper();
        Collection queries = new ArrayList(owners.size());
        Collection idsSubset = new HashSet(owners.size());
        Object[] fkValues;
        Object owner;
        Identity id;

        Iterator iter = owners.iterator();
        while (iter.hasNext())
        {
            owner = iter.next();
            fkValues = helper.extractValueArray(helper.getKeyValues(cld, owner));
            id = getBroker().serviceIdentity().buildIdentity(null, topLevelClass, fkValues);
            idsSubset.add(id);
            if (idsSubset.size() == pkLimit)
            {
                queries.add(buildPrefetchQuery(idsSubset));
View Full Code Here

        this.pbf = pbf;
        this.pbKey = key;
        /*
        be careful when changing initializing order
        */
        brokerHelper = new BrokerHelper(this);
        connectionManager = ConnectionManagerFactory.getInstance().createConnectionManager(this);
        /*
        TODO: find better solution
        MaterializationCache is a interim solution help to solve the problem of not full
        materialized object reads by concurrent threads and will be replaced when
View Full Code Here

        refresh();
        if(key == null) throw new PersistenceBrokerException("Could not instantiate broker with PBKey 'null'");
        this.pbf = pbf;
        this.setPBKey(key);

        brokerHelper = new BrokerHelper(this);
        //connectionManager = ConnectionManagerFactory.getInstance().createConnectionManager(this);
        //objectCache = ObjectCacheFactory.getInstance().createObjectCache(this);
        //sequenceManager = SequenceManagerFactory.getSequenceManager(this);
        //dbAccess = JdbcAccessFactory.getInstance().createJdbcAccess(this);
        //statementManager = StatementManagerFactory.getInstance().createStatementManager(this);
View Full Code Here

                    topLevelClass = broker.getTopLevelClass(objOrProxy.getClass());
                    if(cld == null)
                    {
                        cld = broker.getClassDescriptor(objOrProxy.getClass());
                    }
                    BrokerHelper helper = broker.serviceBrokerHelper();

                    FieldDescriptor[] fields = cld.getPkFields();
                    pks = new Object[fields.length];
                    FieldDescriptor fld;
                    for(int i = 0; i < fields.length; i++)
                    {
                        fld = fields[i];
                        /*
                        we check all PK fields for 'null'-values
                        */
                        Object value = fld.getPersistentField().get(objOrProxy);
                        if(helper.representsNull(fld, value))
                        {
                            result = (Identity) objectToIdentityMap.get(objOrProxy);
                            if(result == null)
                            {
                                pks[i] = transientSequenceManager.getUniqueValue(fld);
View Full Code Here

                m_objectsTopLevelClass = targetBroker.getTopLevelClass(objectToIdentify.getClass());
                m_objectsRealClass = objectToIdentify.getClass();

                // BRJ: definitely do NOT convertToSql
                // conversion is done when binding the sql-statement
                BrokerHelper helper = targetBroker.serviceBrokerHelper();
                m_pkValues = helper.extractValueArray( helper.getKeyValues(cld, objectToIdentify, false) );
            }

            checkForPrimaryKeys();
        }
        catch (Exception e)
View Full Code Here

        this.pbf = pbf;
        this.pbKey = key;
        /*
        be careful when changing initializing order
        */
        brokerHelper = new BrokerHelper(this);
        connectionManager = ConnectionManagerFactory.getInstance().createConnectionManager(this);
        /*
        TODO: find better solution
        InternalCache is a interim solution help to solve the problem of not full
        materialized object reads by concurrent threads and will be replaced when
View Full Code Here

                    m_objectsTopLevelClass = targetBroker.getTopLevelClass(objectToIdentify.getClass());
                    m_objectsRealClass = objectToIdentify.getClass();

                    // BRJ: definitely do NOT convertToSql
                    // conversion is done when binding the sql-statement
                    final BrokerHelper helper = targetBroker.serviceBrokerHelper();
                    final ValueContainer[] pkValues = helper.getKeyValues(cld, objectToIdentify, false);
                    if (pkValues == null || pkValues.length == 0)
                    {
                        throw createException("Can't extract PK value fields", objectToIdentify, null);
                    }
                    m_pkValues = helper.extractValueArray(pkValues);
                }
            }

            checkForPrimaryKeys(objectToIdentify);
        }
View Full Code Here

     */
    protected Query[] buildPrefetchQueries(Collection owners, Collection children)
    {
        ClassDescriptor cld = getOwnerClassDescriptor();
        Class topLevelClass = getBroker().getTopLevelClass(cld.getClassOfObject());
        BrokerHelper helper = getBroker().serviceBrokerHelper();
        Collection queries = new ArrayList(owners.size());
        Collection idsSubset = new HashSet(owners.size());
        Object[] fkValues;
        Object owner;
        Identity id;

        Iterator iter = owners.iterator();
        while (iter.hasNext())
        {
            owner = iter.next();
            fkValues = helper.extractValueArray(helper.getKeyValues(cld, owner));
            id = new Identity(null, topLevelClass, fkValues);
            idsSubset.add(id);
            if (idsSubset.size() == pkLimit)
            {
                queries.add(buildPrefetchQuery(idsSubset));
View Full Code Here

        refresh();
        if(key == null) throw new PersistenceBrokerException("Could not instantiate broker with PBKey 'null'");
        this.pbf = pbf;
        this.setPBKey(key);

        brokerHelper = new BrokerHelper(this);
        //connectionManager = ConnectionManagerFactory.getInstance().createConnectionManager(this);
        //objectCache = ObjectCacheFactory.getInstance().createObjectCache(this);
        //sequenceManager = SequenceManagerFactory.getSequenceManager(this);
        //dbAccess = JdbcAccessFactory.getInstance().createJdbcAccess(this);
        //statementManager = StatementManagerFactory.getInstance().createStatementManager(this);
View Full Code Here

TOP

Related Classes of org.apache.ojb.broker.util.BrokerHelper

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.