| After further investigation, I found out that the issue is at https://github.com/hibernate/hibernate-orm/blob/ec4f20a5fba79444dbd704f1305f961c339dd7d1/hibernate-core/src/main/java/org/hibernate/loader/plan/build/internal/AbstractEntityGraphVisitationStrategy.java#L238 If the collection attribute is included in the graph just as subgraph node, the fetch for that collection defaults to DEFAULT_EAGER which uses FetchType.JOIN, otherwise if the collection attribute in included not just as subgraph node but also as attribute node, the @Fetch(FetchType.SELECT) is respected. I think that line should be changed to {{ AttributeNodeImplementor last = attributeStack.peekLast(); return (last != NON_EXIST_ATTRIBUTE_NODE && last != NON_EXIST_SUBGRAPH_NODE) ? DEFAULT_EAGER : resolveImplicitFetchStrategyFromEntityGraph( attributeDefinition ); }} so that equality to NON_EXIST_SUBGRAPH_NODE is also checked before choosing the fetch strategy. |