Get method of Transient property is called when importing

Hi there,

I met one exception during the import process, which is Cannot get unfetched attribute [acceptanceCriteriaDesign] from detached object B

Basically, I have one class A, which has the ManyToOne relationship with B. In A, I have one transient property called bAcceptanceCriteriaDesign and the code of it is like this:

    @Lookup(type = LookupType.DROPDOWN, actions = "lookup")
    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "B_ID")
    private B b;

    @Transient
    @MetaProperty
    private String bAcceptanceCriteria;


    public String getBAcceptanceCriteria() {
        return b == null ? "" : b.getAcceptanceCriteriaDesign();
    }

However, when I try to import A, even though I didn’t provide mapping for the bAcceptanceCriteriaDesign, it seems the getter of bAcceptanceCriteriaDesign is executed and it causes an exception.

Could you help me?

Hi,

Can you provide a sample app showing the error together with an import config and a file to import?

Then I can take a look at it.

Thanks
Mario

Hi,

See example here how to avoid unfetched attribute exception when related attribute of the transient getter is not loaded:

Also looking at your sample code, if it reflects your real code then you don’t need the bAcceptanceCriteria field,
and instead you should mark getBAcceptanceCriteria getter with @MetaProperty and “related” annotation attribute.
See Attribute Annotations - CUBA Platform. Developer’s Manual