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
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:
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.