LookupField captionproperty

I am passing a collectiondatasource from Parent to a abstractLookup - LookupField.

I believe i have passed all the right parameters but instead of compName , I am get the full entity class name with id. What am i missing here ?

<b>public class </b>Searchcomp <b>extends </b>AbstractLookup
    <b>private </b>LookupField <b>lookupFieldSearch</b>;

    <b>public void </b>init(Map<String, Object> params)
        CollectionDatasource compDs = (CollectionDatasource) params.get(<b>"comp"</b>);


Before setting caption property, set the caption mode:


It is done automatically only when you set caption property from XML descriptor.