Use of tokenlist - error CommonErrorNode [<mismatched token

Dear Srs,

As long as i’m testing the platform i can tell you have put lots of efforts and love for developers. You´re doing a great job!

Now my question: i’m trying to use the tokenlist, i can see its designed to work like web tags, i mean you need two entities with a header - detail relation and you can select from within the options other user register in previous opportunities because you get the optionsDatasource from the same detail but listing all records.

I´m trying to provide the optionsDatasource not from the detail but from other table with a set of defined options to chose from. Since in the optionsDatasource only accept the same entity class used in the datasource property in the tokenlist y build a jpl using a “select new class() from” sentence to force the creation of a detail class from the list of the valid values but i throws an error:

com.haulmont.cuba.core.sys.jpql.JpqlSyntaxException: Errors found for input jpql:[select new com.wonen.wgener.entity.RazonSocial06(  e, m ) from gener$MedioCancelacion01 m left join gener$RazonSocial00 e]
CommonErrorNode [<mismatched token: [@22,31:31='.',<63>,1:31], resync=new com.>]
CommonErrorNode [<mismatched token: [@24,37:37='.',<63>,1:37], resync=.wgener.entity.RazonSocial06(  e, m ) from gener$MedioCancelacion01 m left join gener$RazonSocial00 e>]
	at com.haulmont.cuba.core.sys.jpql.Parser.checkTreeForExceptions(Parser.java:104)
	at com.haulmont.cuba.core.sys.jpql.Parser.parse(Parser.java:40)
	at com.haulmont.cuba.core.sys.jpql.QueryTreeAnalyzer.prepare(QueryTreeAnalyzer.java:55)
	at com.haulmont.cuba.core.sys.jpql.QueryTreeAnalyzer.prepare(QueryTreeAnalyzer.java:46)
	at com.haulmont.cuba.core.global.QueryParserAstBased.getQueryAnalyzer(QueryParserAstBased.java:79)
	at com.haulmont.cuba.core.global.QueryParserAstBased.getParamNames(QueryParserAstBased.java:97)
	at com.haulmont.cuba.gui.data.impl.AbstractCollectionDatasource.createDataQuery(AbstractCollectionDatasource.java:524)
	at com.haulmont.cuba.gui.data.impl.CollectionDatasourceImpl.beforeLoadData(CollectionDatasourceImpl.java:634)
	at com.haulmont.cuba.gui.data.impl.CollectionDatasourceImpl.loadData(CollectionDatasourceImpl.java:608)
	at com.haulmont.cuba.gui.data.impl.CollectionDatasourceImpl.refresh(CollectionDatasourceImpl.java:161)
	at com.haulmont.cuba.gui.data.impl.CollectionDatasourceImpl.refresh(CollectionDatasourceImpl.java:119)
	at com.haulmont.cuba.gui.data.impl.CollectionDatasourceImpl.setSuspended(CollectionDatasourceImpl.java:722)
	at com.haulmont.cuba.gui.data.impl.DsContextImpl.resumeSuspended(DsContextImpl.java:85)
	at com.haulmont.cuba.gui.WindowManager.afterShowWindow(WindowManager.java:1156)
	at com.haulmont.cuba.web.WebWindowManager.showWindow(WebWindowManager.java:410)
	at com.haulmont.cuba.gui.WindowManager.openEditor(WindowManager.java:891)
	at com.haulmont.cuba.web.WebWindowManager.openEditor(WebWindowManager.java:167)
	at com.haulmont.cuba.gui.components.WindowDelegate.openEditor(WindowDelegate.java:258)
	at com.haulmont.cuba.web.gui.WebWindow.openEditor(WebWindow.java:483)
	at com.haulmont.cuba.gui.components.actions.EditAction.internalOpenEditor(EditAction.java:274)
	at com.haulmont.cuba.gui.components.actions.EditAction.actionPerform(EditAction.java:223)
	at com.haulmont.cuba.web.gui.components.WebButton.performAction(WebButton.java:44)
	at com.haulmont.cuba.web.gui.components.WebButton.lambda$new$61446b05$1(WebButton.java:36)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:510)
	at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:200)
	at com.vaadin.event.EventRouter.fireEvent(EventRouter.java:163)
	at com.vaadin.server.AbstractClientConnector.fireEvent(AbstractClientConnector.java:1037)
	at com.vaadin.ui.Button.fireClick(Button.java:377)
	at com.haulmont.cuba.web.toolkit.ui.CubaButton.fireClick(CubaButton.java:54)
	at com.vaadin.ui.Button$1.click(Button.java:54)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:158)
	at com.vaadin.server.ServerRpcManager.applyInvocation(ServerRpcManager.java:119)
	at com.vaadin.server.communication.ServerRpcHandler.handleInvocation(ServerRpcHandler.java:444)
	at com.vaadin.server.communication.ServerRpcHandler.handleInvocations(ServerRpcHandler.java:409)
	at com.vaadin.server.communication.ServerRpcHandler.handleRpc(ServerRpcHandler.java:274)
	at com.vaadin.server.communication.UidlRequestHandler.synchronizedHandleRequest(UidlRequestHandler.java:90)
	at com.vaadin.server.SynchronizedRequestHandler.handleRequest(SynchronizedRequestHandler.java:41)
	at com.vaadin.server.VaadinService.handleRequest(VaadinService.java:1436)
	at com.vaadin.server.VaadinServlet.service(VaadinServlet.java:361)
	at com.haulmont.cuba.web.sys.CubaApplicationServlet.serviceAppRequest(CubaApplicationServlet.java:301)
	at com.haulmont.cuba.web.sys.CubaApplicationServlet.service(CubaApplicationServlet.java:192)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at com.haulmont.cuba.web.sys.CubaHttpFilter.handleNotFiltered(CubaHttpFilter.java:116)
	at com.haulmont.cuba.web.sys.CubaHttpFilter.doFilter(CubaHttpFilter.java:103)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:783)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:789)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1437)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)

The code in the datasource and tokenlist

<dsContext>
    <datasource id="razonSocial00Ds"
                class="com.wonen.wgener.entity.RazonSocial00"
                view="razonSocial-local">
        <collectionDatasource id="condicionPagoDs"
                              property="condicionPago"/>
    </datasource>
    <collectionDatasource id="razonSocial07sCobroDs"
                          allowCommit="false"
                          class="com.wonen.wgener.entity.RazonSocial07"
                          view="razonSocial07-CondCobroview">
        <query>
            <![CDATA[select new com.wonen.wgener.entity.RazonSocial07( 
e, m )
from gener$MedioCancelacion01 m
left join gener$RazonSocial00 e ]]>
        </query>
    </collectionDatasource>
</dsContext>

                    <tokenList id="tokenlistProv"
                               caption="Condicion de pago"
                               datasource="condicionPagoDs">
                        <clearButton caption=" "
                                     icon="icons/close.png"/>
                        <lookup lookup="true"
                                optionsDatasource="razonSocial06sPagoDs"/>
                    </tokenList>

Please your advice how can i get that done. Thanks in advance!

Hi, it seems that this code is incorrect. Probably, it is not supported by our JPQL grammar.

Thanks for quick answer, may be it can be considered to be supported in the future.

Then i’ll think in another way to solve it.

Hi,

We have created YouTrack issue: https://youtrack.cuba-platform.com/issue/PL-10289