FileDescriptor Problems

Hi,

I’m trying to work out how to use FileDescriptors and I’ma little lost.

Lets say I have a model like this

I have added this Attribute to my Entity.

    @JoinTable(name = "DEMO_PRODUCT_FILE_DESCRIPTOR_LINK",
        joinColumns = @JoinColumn(name = "PRODUCT_ID"),
        inverseJoinColumns = @JoinColumn(name = "FILE_DESCRIPTOR_ID"))
    @ManyToMany
    protected List<FileDescriptor> images;

This throws the following error when I try to login.

2018-02-08 20:33:58.543 WARN [http-nio-8080-exec-3/app/anonymous] com.haulmont.cuba.web.app.loginwindow.AppLoginWindow - Unable to login
com.haulmont.cuba.core.global.DevelopmentException: View demo$Product/product-view definition error: property images doesn't exists
 at com.haulmont.cuba.core.sys.AbstractViewRepository.loadView(AbstractViewRepository.java:545)

How can I add multiple documents to an Entity instance?

Is there also a way of viewing the documents linked to child entities instances of a parent entity instance?

thanks

There was this issue, I’m not sure if it would help you:
https://www.cuba-platform.com/discuss/t/attachments-or-file-upload-per-entity-record/2086

Basically, I had this similar problem and the way to have multiple documents to an entity instance is to create another entity Document which will have MANY-TO-ONE or MANY-TO-MANY relation with the predefined entity class FileDescriptor and the Document also have MANY-TO-ONE relation with the entity that needs to be linked with the documents. Also don’t forget to add ONE-TO-MANY relation in the entity is linked with the documents.
Then what I suppose you would need for the edit view is a nested datasource of the documents, so that you could use a multi file upload field to associate the appropriate files to it.

Hope this helps you,
Ivan

Hi Ivan,

Thanks for your reply. I had been looking through that discussion.

I think I’me getting there now with the help of the pointers.