Set view when extending screen


I am trying to use the extension feature in cuba ( I have extended an entity an I would like to add an additional column in the browse view:

@Entity(name = "dm$MyDocument")
public class MyDocument extends Document {
    private static final long serialVersionUID = -5231297063086815719L;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "USER_ID")
    protected User editor;


<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns=""
        <!--<filter id="filter"/>-->
        <table id="dokumentTable">
                <column id="ueberwachungssichtBetriebsstaette"

I now get the error “IllegalStateException: Cannot get unfetched attribute [editor] from detached object …”. So it looks to me as if I have to extend the view for Document. By I don’t know to do this in this case:

  • Document uses the view “document-browse-view” and defining a view with the same name in MyDocument does not work
  • extending the new browse.xml with a collectionDatasource tag does not work either.

Can you help me? Thanks in advance.


1 Like

Hi Joerg,

You should create a view for MyDocument with the same name as a view used for Document in its browse screen. And your new view should extend a base view, adding the required attributes.

For example:

<view class=""
    <property name="foo" view="_minimal"/>


The extended view is not required if the base view extends _local and you add only local attributes in the extended entity.

Such non-trivial definition ensures that the extended view will be used in the screens instead of the base one. Alternatively, you could completely override the datasource definition in the screen, using the extended entity and any view created for it. But the first approach is much more concise.

See also Extensions sample application in Studio or on GitHub