Generate instance name based off a related object

Is this somehow possible?
In my entity I want to display a related object

@InstanceName
@DependsOnProperties({“code”, “objectType”})
public String getInstanceName() {
return String.format("%s (%s)", code, objectType.getName());
}

I’m getting a null pointer and the entire app fails.

Yes it’s possible.
Perhaps you should check for null in the reference:

@InstanceName
@DependsOnProperties({"code", "objectType"})
public String getInstanceName() {
    return String.format("%s (%s)", code, objectType == null ? "" : objectType.getName());
}