NullPointerException in Studio (14.0-202) when creating Recursive/Hierarchical Property

Hi, I’m not sure if I’m doing something wrong, or there is an issue with the current release (14.0-202) of CUBA Studio, but when I create an attribute (either in code, or in the Entity designer, that is based on the current Entity (forming a hierarchical relationship), I get a NullPointerException in Studio as below.

My code looks like this:

     @ManyToOne(fetch = FetchType.LAZY)
     @JoinColumn(name = "PARENT_ID")
     private MyEntity parent;

     public MyEntity getParent() {
         return parent;

     public void setParent(MyEntity parent) {
         this.parent = parent;

Is this something that I am doing wrong, or an issue with Studio?


	at com.intellij.extapi.psi.StubBasedPsiElementBase.isValid(
	at com.intellij.psi.impl.smartPointers.SmartPsiElementPointerImpl.getElement(
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(
	at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(
	at java.base/java.util.Arrays.hashCode(
	at java.base/java.util.Objects.hash(

Hi, Richard!

Unfortunately I can’t reproduce the issue.
Could you please attach idea.log file? (Help -> Show Log in Explorer)
Also a small test project in which you can reproduce the problem could also be very helpful.

I tried to recreate the issue in a new project and seemingly couldn’t, and then returned to the existing project (where I had previously commented out the offending code) and couldn’t recreate it either. It took a fair bit of head scratching to realise what was different and how to reproduce.

The issue was that I had set the name pattern to be cyclic @NamePattern("%s > %s|description,parent") which the GUI editor permitted, but is clearly unsupported. So this seems to be something that the editor should prevent, but also not crash if you do in code.

I assume that, given the error, there is no way of using the parent’s name as part of the child’s display name?

Thanks for providing all details.
The YouTrack issue was created.

You are right, parent attribute can’t be added to the name pattern. Name pattern is used to form _minimal view, but views cannot have cyclic references.
As a workaround you can store parent name in a separate attribute and update it using EntityChangedEvent each time parent changed. This attribute can be safely added to the name pattern.