I am encountering a problem in my business application that in my mind should not happen. I’m asking for your help in order to either fix it on my side or on yours.
I created a sample project that mirrors the exact model that I’m using in my application where it crashes.
My model is pretty simple: I have a base class named BaseClassType. Then two classes inherit it (TestType and TestClassType). Then I have a ONE_TO_MANY association between TestClassType and TestType.
Then I have a class named User which has a MANY_TO_ONE association with TestType class.
Finally I have a class named PowerUser that inherits User class. I don’t use in my sample project but the bug won’t reproduce without it… strange.
User entity’s view looks like this:
How to reproduce: When you’ll run my sample project please create a TestClassType entity and then please create a TestType entity linked with it.
Then please create an User. When you hit save this exception is thrown:
ClassCastException: com.company.sampletest.entity.TestType cannot be cast to com.company.sampletest.entity.TestClassType
SampleTest.zip (88.9 KB)