instance "is a ChangeTracker but has no PropertyChangeListener"

I am starting a CUBA (6.6.3) project with hand-coded (i.e. not created in Studio) Kotlin JPA entities.

I got it to the point where I can create and save a complex object. When I try to open the object for browse or edit, I get this:

IllegalStateException: Entity 'lemongrass.entity.proposaldevelopment.DevelopmentProposal-6e4c1d3e-02db-e1a4-f3c7-b6ce2c9b5788 [managed]' is a ChangeTracker but has no PropertyChangeListener

I have reviewed the forum, particularly XXX is a ChangeTracker but has no PropertyChangeListener. I have verified that the enhanced classes are the ones in my app-global-0.1-SNAPSHOT.jar.

Attached is the decompilation of the enhanced class.

Do you have any thoughts for what to check next?

DevelopmentProposal (1).java (92.4K)

1 Like

Thank you for the pointer. With that, I was able to figure it out.

Change tracking with a PropertyChangeListener is EclipseLink’s ATTRIBUTE change tracking type. In the description of that, it says that I need “LAZY collection relationships, or eager weaving”. First I tried doing eager weaving by putting this in my persistence.xml:

<property name="eclipselink.weaving.eager" value="true"/>

That didn’t work. I’m surprised.

I then took the “fetch = EAGER” off the relationships, and the problem went away. I had taken this from my original data model, but it’s not really necessary in CUBA due explicit fetching defined by views.

Some CUBA persistence-related mechanisms rely on the ability to get changed attributes, so this change tracking policy is necessary. I don’t understand why it depends on the reference fetch type, but anyway, we highly recommend defining only LAZY fetching on the model level, as you correctly mentioned due to using views.