How to create screen brow with TreeTable with hierarchies entity

I have a entity with hierarchical parent same Counterparties category:
public class DmNhomDoiTuong extends StandardEntity {
private static final long serialVersionUID = -5186947233276866359L;

@Lookup(type = LookupType.DROPDOWN, actions = {"lookup", "clear"})
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "PARENT_ID")
protected DmNhomDoiTuong parent;

@Column(name = "MA", nullable = false, unique = true, length = 9)
protected String ma;

@Column(name = "TEN", nullable = false)
protected String ten;

I create new browser screen with table type “TreeTable” and Hierarchical property: “parent”
But on run application create a new entity re reopen browser screen has issue:
IllegalStateException: Cannot get unfetched attribute [parent] from detached object [detached].
How to fix it


You need to create a view that contains the reference attribute.


I was created a view contains the parent reference attribute. Then error not found, but on Edit screen parent input field auto disenabled; so can not create new hierarchy entity of previous entity, can not chose attribute parent

Please show me the way do this. Thanks!

I remove old edit screen and re create new edit screen works is ok.