Hi.
Studio12 and 7.1.1 project on the road.
I did want to have my entities being notified upon modification so that i could fill some fields before persistence.
Found documentation for this at Entity Listeners - CUBA Platform. Developer’s Manual which was fine.
I decided to implement BeforeInsertEntityListener, but for some weird reason, intellij would not find com.haulmont.cuba.core.listener on import.
So what i did was to go to class definition and add “implements BeforeInsertEntityListener” so that maybe it would do its magic to get the import. Intellij told me it had to add the cuba core module. I accepted and then import was fine, i could override the listener method and all was fine.
Then i tried to compile and gradle would whine on the import, making intellij to be blind to it again. Project does not compile anymore due to this.
There must be some black magic somewhere but i can not sort it out. Is there something i forgot to do or did i just somewhat crash my project?
The problem is that if you try to implement a entity listener within an entity class.
The entity class is in the global modul. The entity listener interface is in the core module. Therefore IDEA wants to add the core dependency of cuba to the global module of your app.
Solution: create a dedicated class that acts as the entity listener in the core module of your application.