Hi!

I have a doubt related to PersistentFields and object mappings...
here i go:

I obtain a PersistentField from an object in this way:
-----------------------code starts here---------------------------------

private void loadFieldValues(BaseBusinessObject object)
throws MetadataException
{
Class attributeType = object.getClass();
MetadataManager mm = MetadataManager.getInstance();
DescriptorRepository dr = mm.copyOfGlobalRepository();
ClassDescriptor cld = dr.getDescriptorFor(attributeType);
FieldDescriptor[] fields = cld.getAllRwFields();
 

for (int i = 0; i < fields.length; i++)
{
//the code inside this "for" shows every field from
//(this) object and it works great so i omit it.
}

Vector references = cld.getObjectReferenceDescriptors();

//the following for creates a recursion
//to show every referenced object
//from this and the following referenced objects, etc.

for (int i = 0; i < references.size(); i++)
{
        ObjectReferenceDescriptor reference =
        (ObjectReferenceDescriptor) references.get(i);
        
        System.out.println("-------------- " +
        reference.getAttributeName()
        + " -------------");
        
        String attributeName = reference.getAttributeName();
        
        PersistentField pf =
        PersistentFieldFactory.createPersistentField(attributeType,attributeName);
        
        BaseBusinessObject objReference = (BaseBusinessObject)
        pf.get(object); 
        
        loadFieldValues(objReference); //recursive call!
}

}
-----------------------code ends here---------------------------------

Problems appear when I use primitive ints in primary keys for my
objects. When a referenced object has a 0 key "pf.get(object)" returns
null and not the object referenced by the 0 key.
When I use Integer objects as IDs I dont have any trouble... can anyone
tell me why this happens?

Thanks!

-- 
Saludos,

Martin I. Levi

Centre Tecnol�gic de Transferenci�ncia de Calor
Universitat Polit�cnica de Catalunya
www.cttc.upc.edu


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to