Hi, I have a abstract entity X with subtypes A, B and C
I have another entity Y which has a oneToOne composition of type X
I now want to open an editor screen for Y, I want the view that is used to load Y.X to be based on the concrete type.
The only thing I can specify is a view for type X. I tried creating views with the same name for the subtypes but this doesnt work.
For Clarification, my issue is not related to jpa mapping. my entities work fine, the only problem I have is that the view for loading the entities is always a view on the abstract X type. I want the view to be be based on the actual concrete class.
I am now running against a similar problem with an association.
I have an one-to-many X-A where A is an abstract class that has 2 subclasses B and C,.
The B and C specific properties are not being loaded, how can this be resolved?
Will the same issue arise in version 7 or should this be resolved with the new api?
Unfortunately JPA (and therefore CUBA) is limited in that regard. CUBA Views and JPA loading plans are based on the static entity model and do not take into account real types that are stored in the database.
thanks for the reply, but I’m not sure if I understand.
with jpa loading plans I assume you are referring to entity graphs? I have never actually used this mechanism so I might be off here.
But I checked the specification and javadocs and both the Entitygraph and Subgraph Interfaces have methods to specify subgraphs for loading subclass atrributes.
Only WA helps in this case.
I have no idea what WA is, can you elaborate?
edit: after enumerating all the jpa abbrevations I noticed WA just refers to the “WorkAround”
While loading Y entity system creates fetch group for abstract entity X. In the case of polymorphism the system should create fetch group for X entity with attributes of all subtypes (A, B,C). Because we don’t know what is the child of X type in the database. I’m not sure that the EclipseLink JPA can handle such cases. It requires additional research.