BaseGenericIdEntity IllegalArgumentException

I have created an enity which uses BaseGenericIdEntity and here i have created an embedded entity MvaKodePK. In this embedded entity i have created one attribute ID of type Integer.

Data is loaded normally into table and I am able to create an entity. But when I try to Edit the entity I get the following error? Table view and editor is generated by Cuba Studio. No modifications made by me.

IllegalArgumentException: You have attempted to set a value of type class java.lang.Integer for parameter entityId with expected type of class no.sw.regnskap.entity.generic.MvaKodePK from query string select e from regnskap$MvaKode e where e.id = :entityId.

Did you manage to find a solution to the problem?

You have to convert the value to an object, then extract the ID from object an add the ID to query. You can’t add the ID directly from entity object but extract ID object an then use this object. It is a bit cumbersome but I think it is the only way. Maby other have an easier way to it.