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
As an example let's take the book and author use-case...
In my database I have a author_id foreign key that maps to a book's id column
If these are set to lazy fetch type, we could assume that we should be able to filter by bookId on the author table without needing to join to the book table
For some reason JPA derived methods decide instead of a where clause like so
SELECT a.*FROM authors a
WHEREa.book_id=?1
it does the following:
SELECT a.*FROM author a
LEFT JOIN books b ona.book_id=b.idWHEREb.id=?1
This may make more sense for eagerly fetched entities but can someone help me understand why JPA would do this or if this should be the way it's done?
This is having a noticeable performance impact on larger table joins. Currently using native queries as a workaround although with a huge amount of database tables that is cumbersome and messy.
Thanks
The text was updated successfully, but these errors were encountered:
As an example let's take the book and author use-case...
In my database I have a author_id foreign key that maps to a book's id column
If these are set to lazy fetch type, we could assume that we should be able to filter by bookId on the author table without needing to join to the book table
For some reason JPA derived methods decide instead of a where clause like so
it does the following:
This may make more sense for eagerly fetched entities but can someone help me understand why JPA would do this or if this should be the way it's done?
This is having a noticeable performance impact on larger table joins. Currently using native queries as a workaround although with a huge amount of database tables that is cumbersome and messy.
Thanks
The text was updated successfully, but these errors were encountered: