You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you have a relation from a class to an interface, it would be great to have a two column mapping with one for the entity name (or discriminator) or the target table name and one (at least) for the identifier of the row in that target table.
Fetching graphs including such relationships might be intensive on the database and depends of the model complexity (inheritance, relationship cardinality, ... but this model also allows to fetch graphs like per-implementation and allows to keep the table model unchanged when a new interface implementation is added.
SELECT*FROM TableA a JOIN TableC c ona.refB_Id=c.idand refB_type='EntityC'UNIONSELECT*FROM TableA a JOIN TableD c ona.refB_Id=c.idand refB_type='EntityD'
Query aspects
Querying through the links would be great if JPA would support casting but querying on getter/setter methods declared on the interface can also be a first step.
entityManager.createQuery("select e from EntityA e where e.refB.name like :param, ClassA.class)
The text was updated successfully, but these errors were encountered:
Anybody can get the code and contribute such things. We already provide 2 such mapping strategies, multiple FKs, or single String which includes the class + id.
Hello,
If you have a relation from a class to an interface, it would be great to have a two column mapping with one for the entity name (or discriminator) or the target table name and one (at least) for the identifier of the row in that target table.
TableA
TableC
TableD
SQL aspects
Fetching graphs including such relationships might be intensive on the database and depends of the model complexity (inheritance, relationship cardinality, ... but this model also allows to fetch graphs like per-implementation and allows to keep the table model unchanged when a new interface implementation is added.
Query aspects
Querying through the links would be great if JPA would support casting but querying on getter/setter methods declared on the interface can also be a first step.
The text was updated successfully, but these errors were encountered: