sec$EntityLog error after upgrading from framework 6.10 to 7.0.5

Hello,

I am trying to upgrade our current project from Framework 6.10 to 7.0.5.

Here is the code for one of our screens:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
        caption="msg://editorCaption"
        class="com.solutiondomain.fieldsolution.web.job.JobEdit"
        datasource="jobDs"
        focusComponent="fieldGroup"
        messagesPack="com.solutiondomain.fieldsolution.web.job">
    <dsContext>
        <datasource id="jobDs"
                    class="com.solutiondomain.fieldsolution.entity.Job"
                    view="job-edit-view">
            <collectionDatasource id="attachedFilesDs"
                                  property="attachedFiles"/>
        </datasource>
        <collectionDatasource id="tasksDs"
                              class="com.solutiondomain.fieldsolution.entity.Task"
                              maxResults="20"
                              view="task-with-job">
            <query>
                <![CDATA[select e from fieldsolution$Task e where e.job = :ds$jobDs]]>
            </query>
        </collectionDatasource>
        <collectionDatasource id="logDs"
                              class="com.haulmont.cuba.security.entity.EntityLogItem"
                              view="logView">
            <query>
                <![CDATA[select i from sec$EntityLog i
                where i.entityRef.entityId = :ds$jobDs order by i.eventTs]]>
            </query>
            <collectionDatasource id="logAttrDs"
                                  property="attributes"/>
        </collectionDatasource>
        <datasource id="companyDs"
                    class="com.solutiondomain.fieldsolution.entity.Company"
                    view="_minimal"/>
    </dsContext>

Unfortunately we are getting this error when trying to test:

IllegalArgumentException: You have attempted to set a value of type class com.solutiondomain.fieldsolution.entity.Job for parameter ds_jobDs with expected type of class java.util.UUID from query string 
                select i from sec$EntityLog i
                where i.entityRef.entityId = :ds_jobDs order by i.eventTs

I have tried the following query as per the example:

<![CDATA[select i from sec$EntityLog i
                where i.entityRef.entityId = :job order by i.eventTs]]>

But that didn’t seem to work either.

Any help would be greatly appreciated.

Regards

Matt
Solution domain

Hello @matt.keeble

According to changes introduced in CUBA 7 automatic conversion between entity and id is no longer supported - GitHub issue.

Now you should write queries in this way:

select e from app$MyEntity e where e = :entity

or:

select e from app$MyEntity e where e.id = :entityId

But in case of migration the cuba.implicitConversionOfJpqlParams app property should be added to app config that keeps old behavior. Could you check whether the config exists or not?

Regards,
Daniil

Hi Daniil,

I have now resolved this issue - thank you.

Is there a way of marking the topic as closed?

Thanks

Matt

Could you describe what was wrong and how you solved the problem? It may help other users in future

I made the following query changes:

<query>
  <![CDATA[select e from fieldsolution$Task e where e.job.id = :ds$jobDs.id]]>
</query>

<query>
  <![CDATA[select i from sec$EntityLog i
  where i.entityRef.entityId = :ds$jobDs.id order by i.eventTs]]>

Matt