I am using JPA & MySQL.
If I have a bunch of entities that are related as follows:
- Grandparent_entity has many Parent_entity (OneToMany). Persisted with a join table.
- Parent_entity has one Child_entity (OneToOne). Persisted with child_uuid in parent table.
If I am given only the child unique key, how do I get the grandparent entity?
My idea is a query with 3 joins - child to parent, parent to join table, join table to grandparent. Is this the best way?