Exception "entity is a ChangeTracker but has no PropertyChangeListener" using LinkedHashSet

Hi, I have two simple entities with ManyToMany relation between them, and each of them contains a owning property with related entities of the other.

Example:
on entity Teacher


    @JoinTable(name = "WEBSCHOOL_TEACHER_APPOINTMENT_TYPE_LINK",
        joinColumns = @JoinColumn(name = "TEACHER_ID"),
        inverseJoinColumns = @JoinColumn(name = "APPOINTMENT_TYPE_ID"))
    @ManyToMany
    protected Set<AppointmentType> enabledAppointmentTypes;

on entity AppointmentType


    @JoinTable(name = "WEBSCHOOL_TEACHER_APPOINTMENT_TYPE_LINK",
        joinColumns = @JoinColumn(name = "APPOINTMENT_TYPE_ID"),
        inverseJoinColumns = @JoinColumn(name = "TEACHER_ID"))
    @ManyToMany
    protected Set<Teacher> teachers;

In this situation, if I have a browse screen for, say, the AppointmentType entity everything works fine.

But, if I swap the Set with a LinkedHashSet for both entities, a IllegalStateException: entity XXX is a ChangeTracker but has no PropertyChangeListener shows up as soon as I open that screen.

Paolo

EDIT: tested on CUBA ver 6.6.4

Hi Paolo,

I can confirm that the problem exists. We will deal with it ASAP, see https://youtrack.cuba-platform.com/issue/PL-9801

Hi @knstvk

I realized that the linked issue has been marked as known issue, with a SO post as a reference.

the SO author used a concrete impl class as the type, and that was the motivation for the error.

A possible workaround could be adding an annotation to add to attributes, for specifying the actual implementation needed, for example LinkedHashSet.
It seems that concrete implementation works well, it is only the type declaration that must be Set.

Paolo

Hi Paolo,
What annotation can specify the implementation class? EclipseLink has its own implementation classes for collections like IndirectSet.

Hi
only a hint, for example with a custom enum, to be read at the ORM level to select a different implementation class for collection. Probably it could require fiddling at the eclipselink level, I’m not saying it is a “straightforward” solution :wink:

Paolo