I am using the Single Table inheritance strategy in Postgres in JPA. Some of my child classes have collection fields of their own, and currently when I do a get on the parent class, it fetches all the rows, then for each row where it needs to fetch the collections it does a separate query.
How do I tell JPA to do only a single joined query with the child collections so I don't face the N+1 query problem? If this was a single class I could have written a JPA query myself and did a join on the child collections, but since I am only doing a get on the parent class, I can't write a query to join on the child collections.