TokenList doesn't work

Hi,

I have a tokenList which doesn’t work. The select function works good but doesn’t save records in database @JoinTable(name = “CRM_TRANSACTION_PAYMENT_LINK”.
Actually Add and Remove buttons work well and I can remove TokenList but just I’m curios what is the issue.
Please give me a hint.

TokenList is placed in Payment view. Payment is nested in Transaction (many-to-many).

<datasource id="transactionDs"
            class="com.entity.Transaction"
            view="transaction-with-payment">

    <collectionDatasource id="paymentDs"
                            property="payment"/>
</datasource>

<tokenList id="paymentsTokenList"                               
            captionProperty="number"
            clearEnabled="false"
            datasource="paymentDs"
            simple="true">
    <lookup lookup="true"
            lookupScreen="crm$Payment.browse"
            multiselect="true"
            openType="DIALOG"/>
</tokenList>

<view class="com..entity.Transaction"
        extends="_local"
        name="transaction-with-payment"
        systemProperties="true">
    <property name="payment" view="_local">
        <property name="bank" view="_minimal"/>
    </property>
</view>

Hello @neutrino

Could you clarify a version of CUBA used in the project? Have you tried to add payments in different way?

Regards,
Daniil

Is Cuba6 imported in Cuba 7. In Cuba 7 I added a new attribute (bank) in Payment, many-to one.
Bank UI is now made in Cuba 7 (with Data Containers).
For the old Cuba 6 version, TokenList works.

I’ll check you case and give an answer soon.

1 Like

Hello @neutrino

Unfortunately I cannot reproduce the problem. Please take a look at attached project and check if some difference with your case exists.

tokenlist-mto.zip (76.4 KB)

Please share sample project if possible.

Regards,
Daniil

Thank you very much for your effort.
Unfortunately the model is quite different.

In your demo Item is made in Cuba 7 and Order is made in Cuba 6.
In my case both are made in Cuba 6 and tokenList works. So far so good.
In addition in Item (payment) I added another attribute Bank (many_to_one) and also a separate Entity (Bank) that has screens made in Cuba 7. All the screens has lookup actions check it.
I don’t know if this is the reason of the problem but after that tokenList didn’t work anymore.

It’s not important what version of API is used for child entity (Item), master entity editors are based on CUBA 6 in both cases.

Could you clarify what exactly is not saved? Payments are not saved in Transaction?

The bank property is not related to TokenList because it works only with Transaction and its Payments.

Payments are not saved in Transaction anymore.
Maybe you can give me a hint, where/what should I investigate?

Pay attention… the Add Remove buttons work.
I saw that Add Remove buttons are related to the (payment) table while tokenList is related to the Datasource(paymentDs).
The tokenList advantage is that can be positioned in any screen (tab).

I cannot give you any hint because the case described in your message is not reproduced in the sample project.

As an option you can prepare a project to demonstrate the issue.

Hello Daniil,

Now I tested your tokenlist demo.
Unfortunately doesn’t work!
Please enter, let say, two Items in Items UI.
After that please select an Item from tokenList Order (don’t use Add and Remove buttons!).
Apparently it works but try to REOPEN Order. The selected Item(s) are gone!
Doesn’t save in database. The same issue!

I’ve checked the sample again and recorded a demo for you:

tokenlist_mtm

Could you check app logs for some errors?

Regards,
Daniil

I also recorded a demo for you but unfortunately .mp4 is not authorized.
I have no errors but neither any commit:

2019-05-02 16:15:30.672 DEBUG [http-nio-8080-exec-8/app/admin] com.haulmont.cuba.web.App - Closing all windows in all UIs
2019-05-02 16:15:30.677 DEBUG [http-nio-8080-exec-8/app-core/admin] com.haulmont.cuba.security.app.UserSessions - Removed session: cf78aa04-f338-27cb-1964-979c7b0d2f69 [admin], since: Thu May 02 16:09:53 EEST 2019, lastUsed: Thu May 02 16:10:05 EEST 2019
2019-05-02 16:15:30.678 INFO  [http-nio-8080-exec-8/app-core/admin] com.haulmont.cuba.security.auth.AuthenticationManagerBean - Logged out: cf78aa04-f338-27cb-1964-979c7b0d2f69 [admin]
2019-05-02 16:15:30.692 DEBUG [http-nio-8080-exec-8] com.haulmont.cuba.web.DefaultApp - connectionStateChanged connected: false, authenticated: false
2019-05-02 16:15:30.693 DEBUG [http-nio-8080-exec-8] com.haulmont.cuba.web.App - Closing all windows in all UIs
2019-05-02 16:15:30.701 DEBUG [http-nio-8080-exec-8/app/anonymous] com.haulmont.cuba.web.DefaultApp - connectionStateChanged connected: true, authenticated: false
2019-05-02 16:15:30.702 DEBUG [http-nio-8080-exec-8/app/anonymous] com.haulmont.cuba.web.App - Closing all windows in all UIs
2019-05-02 16:15:32.365 INFO  [http-nio-8080-exec-7/app-core/server] com.haulmont.cuba.security.auth.AuthenticationManagerBean - Logged in: e39911c4-e086-affc-04ee-1a5afd2c72c3 [admin]
2019-05-02 16:15:32.368 DEBUG [http-nio-8080-exec-7/app/admin] com.haulmont.cuba.web.DefaultApp - connectionStateChanged connected: true, authenticated: true
2019-05-02 16:15:32.368 DEBUG [http-nio-8080-exec-7/app/admin] com.haulmont.cuba.web.App - Closing all windows in all UIs
2019-05-02 16:15:32.370 DEBUG [http-nio-8080-exec-7/app/admin] com.haulmont.cuba.web.DefaultApp - Session reinitialized: HttpSession=org.apache.catalina.session.StandardSessionFacade@4ed9e298, timeout=1800sec, UserSession=e39911c4-e086-affc-04ee-1a5afd2c72c3 [admin]
2019-05-02 16:15:32.392 DEBUG [http-nio-8080-exec-7/app-core/admin] com.haulmont.cuba.core.app.RdbmsStore - loadList: metaClass=sec$UserSubstitution, view=com.haulmont.cuba.security.entity.UserSubstitution/app, query=select us from sec$UserSubstitution us where us.user.id = :userId and (us.endDate is null or us.endDate >= :currentDate) and (us.startDate is null or us.startDate <= :currentDate) and (us.substitutedUser.active = true or us.substitutedUser.active is null) order by us.substitutedUser.name
2019-05-02 16:15:34.605 DEBUG [http-nio-8080-exec-10/app-core/admin] com.haulmont.cuba.core.app.RdbmsStore - loadList: metaClass=sec$Filter, view=com.haulmont.cuba.security.entity.FilterEntity/app, query=select f from sec$Filter f left join f.user u where f.componentId = :component and (u.id = :userId or u is null) order by f.name
2019-05-02 16:15:34.660 DEBUG [http-nio-8080-exec-10/app-core/admin] com.haulmont.cuba.core.app.RdbmsStore - loadList: metaClass=sample_Item, view=com.company.sample.entity.Item/item-view, query=select e from sample_Item, max=5000
2019-05-02 16:15:36.067 DEBUG [http-nio-8080-exec-4/app-core/admin] com.haulmont.cuba.core.app.RdbmsStore - loadList: metaClass=sec$Filter, view=com.haulmont.cuba.security.entity.FilterEntity/app, query=select f from sec$Filter f left join f.user u where f.componentId = :component and (u.id = :userId or u is null) order by f.name
2019-05-02 16:15:36.116 DEBUG [http-nio-8080-exec-4/app-core/admin] com.haulmont.cuba.core.app.RdbmsStore - loadList: metaClass=sample_Order, view=com.company.sample.entity.Order/order-view, query=select e from sample_Order e, max=50
2019-05-02 16:15:37.693 DEBUG [http-nio-8080-exec-2/app-core/admin] com.haulmont.cuba.core.app.RdbmsStore - load: metaClass=sample_Order, id=35435976-53f7-cc7e-4961-99110d5ba6f8, view=com.company.sample.entity.Order/order-view
2019-05-02 16:15:37.719 DEBUG [http-nio-8080-exec-2/app-core/admin] com.haulmont.cuba.core.app.RdbmsStore - loadList: metaClass=sample_Item, view=com.company.sample.entity.Item/item-view, query=select i from sample_Item i, max=10000
2019-05-02 16:15:44.671 DEBUG [http-nio-8080-exec-15/app-core/admin] com.haulmont.cuba.core.app.RdbmsStore - load: metaClass=sample_Order, id=35435976-53f7-cc7e-4961-99110d5ba6f8, view=com.company.sample.entity.Order/order-view
2019-05-02 16:15:44.695 DEBUG [http-nio-8080-exec-15/app-core/admin] com.haulmont.cuba.core.app.RdbmsStore - loadList: metaClass=sample_Item, view=com.company.sample.entity.Item/item-view, query=select i from sample_Item i, max=10000

However if I use Add / Remove buttons it works:

2019-05-02 16:17:04.521 DEBUG [http-nio-8080-exec-14/app-core/admin] com.haulmont.cuba.core.app.RdbmsStore - loadList: metaClass=sec$Filter, view=com.haulmont.cuba.security.entity.FilterEntity/app, query=select f from sec$Filter f left join f.user u where f.componentId = :component and (u.id = :userId or u is null) order by f.name
2019-05-02 16:17:04.570 DEBUG [http-nio-8080-exec-14/app-core/admin] com.haulmont.cuba.core.app.RdbmsStore - loadList: metaClass=sample_Item, view=com.company.sample.entity.Item/item-view, query=select e from sample_Item, max=5000
2019-05-02 16:17:08.215 DEBUG [http-nio-8080-exec-8/app-core/admin] com.haulmont.cuba.core.app.RdbmsStore - commit: commitInstances=[com.company.sample.entity.Order-35435976-53f7-cc7e-4961-99110d5ba6f8 [detached]], removeInstances=[]
2019-05-02 16:17:08.249 DEBUG [http-nio-8080-exec-8/app-core/admin] com.haulmont.cuba.security.app.EntityLog - Loading entities
2019-05-02 16:17:08.254 DEBUG [http-nio-8080-exec-8/app-core/admin] com.haulmont.cuba.security.app.EntityLog - Loaded: entitiesAuto=0, entitiesManual=0
2019-05-02 16:17:09.680 DEBUG [http-nio-8080-exec-7/app-core/admin] com.haulmont.cuba.core.app.RdbmsStore - load: metaClass=sample_Order, id=35435976-53f7-cc7e-4961-99110d5ba6f8, view=com.company.sample.entity.Order/order-view
2019-05-02 16:17:09.702 DEBUG [http-nio-8080-exec-7/app-core/admin] com.haulmont.cuba.core.app.RdbmsStore - loadList: metaClass=sample_Item, view=com.company.sample.entity.Item/item-view, query=select i from sample_Item i, max=10000

These logs don’t say anything. I can’t help you without any problem-specific details.

Provide a sample when the issue can be reproduced and i’ll investigate the problem

Regards,
Daniil

Hi Daniil,

As long as the same demo works on your machine and doesn’t work on my computer I think is a configuration problem.
Below you can see my settings:
Cuba Studio installed as Idea plugin.
platform version: platform-7.0.4
database type: hsqldb
plugin: CUBA V9.0-1813
JVM: java-8-oracle
Intellij 2019.1

Is there any possibility to provide you a recording demo?

Regards,
n

A post was split to a new topic: Tokenlist is not recorded in the datasource