6.3.RC1 - MappedSuperclass in Application Component - Studio error

Hi,

i encountered a problem with the application components feature. I created a component that should hold certain base classes. Here you will find the example: https://github.com/mariodavid/cuba-example-application-components

When i open the application in studio i can successfully select NamedEntity as the Superclass (for Customer class). But next time i opened up the Customer i got an error along those lines: “unmatched attribute for column ID”:


[21:04:49.484] Unexpected error
java.lang.IllegalStateException: Entity com.company.platform.projectmanagement.Customer has no attribute applicable for table id column
[21:04:49.485] Exception has been thrown by com.haulmont.studio.ui.app.a@4c5cc19f:
[21:04:49.485] java.lang.IllegalStateException: Entity com.company.platform.projectmanagement.Customer has no attribute applicable for table id column
 at com.haulmont.studio.backend.e.b.o(SourceFile:546)
 at com.haulmont.studio.backend.e.c.a.e(SourceFile:381)
 at com.haulmont.studio.backend.e.c.u.j(SourceFile:125)
 at com.haulmont.studio.backend.e.c.K.a(SourceFile:106)
 at com.haulmont.studio.backend.e.c.K.a(SourceFile:99)
 at com.haulmont.studio.backend.e.c.a.c(SourceFile:249)
 at com.haulmont.studio.backend.e.c.N.a(SourceFile:315)
 at com.haulmont.studio.backend.e.c.N.a(SourceFile:110)
 at com.haulmont.studio.backend.e.c.a.a(SourceFile:408)
 at com.haulmont.studio.backend.e.c.a.c(SourceFile:397)
 at com.haulmont.studio.ui.c.a.a(SourceFile:63)
 at com.haulmont.studio.ui.app.aK.p(SourceFile:660)
 at com.haulmont.studio.ui.app.aK.o(SourceFile:648)
 at com.haulmont.studio.ui.app.aK.d(SourceFile:819)
 at com.haulmont.studio.ui.app.aW.buttonClick(SourceFile:187)
 at sun.reflect.GeneratedMethodAccessor100.invoke(Unknown Source)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:497)
 at com.vaadin.event.ListenerMethod.receiveEvent(ListenerMethod.java:508)

so i couldn’t edit it further. I created this example: https://github.com/mariodavid/cuba-example-application-components (where the project-management-platform project contains the MappedSuperclass and the project-management-app uses it).

Unfortunately as i just double check it before posting this, and re-clone it to another directory: Well, it does not have the error anymore (so i was able to change the superclass from Customer to NamedEntity). Then i started the app but when i want to create a customer i get the following error:


SQLIntegrityConstraintViolationException: integrity constraint violation: NOT NULL check constraint; SYS_CT_10834 table: PM_CUSTOMER column: NAME

Generally the dependency should be in included correctly, because i’ve a SayHelloService in the platform component which worked quite well.

One additional problem i encountered: When i opened the project-management-app in studio there was just the appointments dependency displayed, not the project-management-platform (although it is included as a dependency in the build.gradle file and in the web.xml files as well).

Perhaps you might want to take a look at these errors.

Bye,
Mario

Hi Mario,
The problem is probably caused by the fact that the root package of the “project-management-platform” project includes the root package of the “appointments” project. I’ve renamed the former into “com.company.platform.main” (added one more level), and now the application project opens correctly. See https://github.com/mariodavid/cuba-example-application-components/pull/1
We will think how to avoid this situation, thank you for reporting the issue.

Hi Konstantin,

thanks for the investigation. I already thought about that it has something to do with the package structure but that was more of an unqualified guess :slight_smile:

So what i tried now is the described situation above: Customer (project-management-app) extends NamedEntity (project-management-platform) (see https://github.com/mariodavid/cuba-example-application-components/commit/57efae7ab1b8ebd3af8d463a0b03ca11d0dc0b03).

In studio i can open the entities and edit them - so no problem here anymore. But unfortunately i can’t use the NamedEntity. The reason is that when i want to store a Customer the error from above is not gone:

SQLIntegrityConstraintViolationException: integrity constraint violation: NOT NULL check constraint; SYS_CT_10385 table: PM_CUSTOMER column: NAME

Do you have a glue what is going on?

Bye,
Mario

Hi Mario,
This is because EclipseLink didn’t enhance your NamedEntity in the component project because it has no descendants, so it thinks it is useless. One of the small optimizations that cause more harm than good. We cannot fix it, so just create a dummy entity in the component project: https://github.com/mariodavid/cuba-example-application-components/pull/2. We do the same in the platform.
We’ll mention this feature in the docs, thanks for the hint!

Hi Konstantin,

thank you for the information. Is your fork of eclipselink not suitable for these kinds of adjustments or is this something that is too much related to the core of the library? Creating a dummy entity seems reasonable though.

Bye,
Mario

We try to make as few changes as possible, but fixing this would require too much work (BTW, there is a ticket in EclipseLink bugzilla for this).

Hi

The problem with root packages is fixed in the Studio version 6.3.0.
Components with the “com.company.group” and “com.company.group.project” root packages should not conflict.