Package org.apache.ojb.broker.metadata

Examples of org.apache.ojb.broker.metadata.FieldDescriptor


                ValueContainer[] pkValues = brokerForClass.serviceBrokerHelper().getKeyValues(cld, obj);

                Criteria criteria = new Criteria();
                for (int j = 0; j < pkFields.length; j++)
                {
                    FieldDescriptor fld = pkFields[j];
                    criteria.addEqualTo(fld.getPersistentField().getName(), pkValues[j].getValue());
                }

                if (crit == null)
                    crit = criteria;
                else
View Full Code Here


    private void refreshPKFields()
    {
        FieldDescriptor[] flds = getClassDescriptor().getPkFields();
        for(int i = 0; i < flds.length; i++)
        {
            FieldDescriptor fld = flds[i];
            addFieldImage(beforeImage, fld);
        }
    }
View Full Code Here

        if(getClassDescriptor().isLocking())
        {
            FieldDescriptor[] flds = getClassDescriptor().getLockingFields();
            for(int i = 0; i < flds.length; i++)
            {
                FieldDescriptor fld = flds[i];
                addFieldImage(beforeImage, fld);
            }
        }
    }
View Full Code Here

                ValueContainer[] pkValues = broker.serviceBrokerHelper().getKeyValues(cld, obj);

                Criteria criteria = new Criteria();
                for (int j = 0; j < pkFields.length; j++)
                {
                    FieldDescriptor fld = pkFields[j];
                    criteria.addEqualTo(fld.getPersistentField().getName(), pkValues[j].getValue());
                }

                if (crit == null)
                    crit = criteria;
                else
View Full Code Here

        fields[0] = obj.getClass(); // we must notice if the object class changes
        count++;

        for (int i = 0; i < fieldDescs.length; i++)
        {
            FieldDescriptor fd = fieldDescs[i];
            PersistentField f = fd.getPersistentField();
            fields[count] = f.get(obj);
            count++;
        }

        int countRefs = 0;
View Full Code Here

        }
        count++;

        for (int i = 0; i < fieldDescs.length; i++)
        {
            FieldDescriptor fd = fieldDescs[i];
            PersistentField f = fd.getPersistentField();
            f.set(obj, fields[count]);
            count++;
        }

        for (Iterator it = refDescs.iterator(); it.hasNext(); count++)
View Full Code Here

        if (cld.getFieldDescriptions() != null)
        {
            it = new ArrayIterator(cld.getFieldDescriptions());
            while (it.hasNext())
            {
                FieldDescriptor fieldDesc = (FieldDescriptor)it.next();
                newChildren.add(new OjbMetaFieldDescriptorNode(
                        this.getOjbMetaTreeModel().getRepository(),
                        this.getOjbMetaTreeModel(),
                        this,
                        fieldDesc));
View Full Code Here

        //System.out.println("next free UID for InterfaceArticle : " + uid);

        // the next id from the sequence should be uid + 1, even if we did not store any object using uid.
      ClassDescriptor cld = broker.getClassDescriptor(InterfaceArticle.class);
        FieldDescriptor fld = cld.getFieldDescriptorByName("articleId");

        int nextUid = 1; //broker.serviceSequenceManager().getUniqueId(fld);
        assertEquals("nextUid - uid = 1 !!!", 1, nextUid - uid);

  }
View Full Code Here

        ClassDescriptor mif = pb.getClassDescriptor(newObj.getClass());
        FieldDescriptor[] fieldDescs = mif.getFieldDescriptions();

        for (int i = 0; i < fieldDescs.length; i++)
        {
            FieldDescriptor fd = fieldDescs[i];
            PersistentField f = fd.getPersistentField();
            f.set(oldObj, f.get(newObj));
        }

        // N:1 relations
        Iterator iter = mif.getObjectReferenceDescriptors().iterator();
View Full Code Here

     */
    public static long getMaxIdForClass(
            PersistenceBroker brokerForClass, ClassDescriptor cldForOriginalOrExtent, FieldDescriptor original)
            throws PersistenceBrokerException
    {
        FieldDescriptor field = null;
        if (!original.getClassDescriptor().equals(cldForOriginalOrExtent))
        {
            // check if extent match not the same table
            if (!original.getClassDescriptor().getFullTableName().equals(
                    cldForOriginalOrExtent.getFullTableName()))
            {
                // we have to look for id's in extent class table
                field = cldForOriginalOrExtent.getFieldDescriptorByName(original.getAttributeName());
            }
        }
        else
        {
            field = original;
        }
        if (field == null)
        {
            // if null skip this call
            return 0;
        }

        String column = field.getColumnName();
        long result = 0;
        ResultSet rs = null;
        Statement stmt = null;
        StatementManagerIF sm = brokerForClass.serviceStatementManager();
        String table = cldForOriginalOrExtent.getFullTableName();
View Full Code Here

TOP

Related Classes of org.apache.ojb.broker.metadata.FieldDescriptor

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.