Unable to remove a record from when the entity has associations

Hi,
When I am removing a record from the list page it shows the following exception.
ClassCastException: org.eclipse.persistence.internal.indirection.jdk8.IndirectList cannot be cast to com.haulmont.cuba.core.entity.Entity
In our application there is an Institute entity which is associated to employee with one to many relation and with the same entity with many to one relation.
The design is for one Institute can have child institutes and all institute has it’s own employees. I created a parent institute and associate it to a child institute. I get the above exception while removing the child institute or parent institute. It works perfectly if the parent and child institutes are not related to each other.

We are using CUBA 6.2.3 and MySQL database. Also we have configured the application to support soft delete.

Please tell me a way to fix this issue.

Thanks,
Saumm

Hi
I am trying to reproduce the issue with different combination of screen parameters, but the specified fault does not appear.
It seems some significant details of your configuration are missed.

Could you prepare an example project in which the described exception could be observed and share it here?

The project could be archived by the use of zipProject gradle task

Hi I am attaching a similar demo project with this comment. I am also attaching the screen-shot of the exception.
Please help me to fix the issue.
Steps to reproduce.

  1. Create one Institute. Say University
  2. Create another Institute : say Technical Institute with parent as University
  3. Create another Institute: say Computer Science Institute with parent as Technical Institute
  4. Now try to remove University or Technical Institute.
    You will find the

ClassCastException: org.eclipse.persistence.internal.indirection.jdk8.IndirectList cannot be cast to com.haulmont.cuba.core.entity.Entity

exception.

AssociationTest.zip (83.7K)

Error msg

Hi
The Entity “Institution” in your project has ONE_TO_MANY relation to itself. So it has “children” and “parentInstitute” attributes.
Both attributes have On delete = CASCADE. This is meaningless.

Try to set On delete = CASCADE only for one of these attributes (leave empty for the other) and the fault should disappear.

For more information about delete policy see the documentation: [url=https://doc.cuba-platform.com/manual-6.2/delete_policy.html]https://doc.cuba-platform.com/manual-6.2/delete_policy.html[/url]

Regards.