The problem described below only happens with to-one relationships. To-many is working fine.
I have the following @Entity in my application.
I'm using the following @Repository to look for Account.
My test endpoint contains a simple method.
When I execute this endpoint, this is what I'm seeing in the log.
As you can see, in the middle of the account name and the nationality name, there's an extra query just to select the nationality field. It means if I have 50 records, 50 additional queries got executed. May I know how I can fix this behaviour?
Below is what I used in pom.xml to activate Hibernate Bytecode Enhancer
Windows 10, Spring Boot v2.2.7, Hibernate v5.4.15.Final, `spring-data-jpa-entity-graph` v2.2.8, SQL Server, Java 8