/** * INTERNAL: * Allow the mapping the do any further batch preparation. */ @Override protected void postPrepareNestedBatchQuery(ReadQuery batchQuery, ObjectLevelReadQuery query) { super.postPrepareNestedBatchQuery(batchQuery, query); // Force a distinct to filter out m-1 duplicates. // Only set if really a m-1, not a 1-1 if (!this.isOneToOneRelationship && ((ObjectLevelReadQuery)batchQuery).getBatchFetchPolicy().isJOIN()) { if (!((ObjectLevelReadQuery)batchQuery).isDistinctComputed() && (batchQuery.getSession().getPlatform().isLobCompatibleWithDistinct() || !Helper.hasLob(batchQuery.getDescriptor().getSelectionFields((ObjectLevelReadQuery)batchQuery)))) { ((ObjectLevelReadQuery)batchQuery).useDistinct(); } } if (this.mechanism != null) { this.mechanism.postPrepareNestedBatchQuery(batchQuery, query); } }
/** * INTERNAL: * Allow the mapping the do any further batch preparation. */ @Override protected void postPrepareNestedBatchQuery(ReadQuery batchQuery, ObjectLevelReadQuery query) { super.postPrepareNestedBatchQuery(batchQuery, query); // Force a distinct to filter out m-1 duplicates. // Only set if really a m-1, not a 1-1 if (!this.isOneToOneRelationship && ((ObjectLevelReadQuery)batchQuery).getBatchFetchPolicy().isJOIN()) { if (!((ObjectLevelReadQuery)batchQuery).isDistinctComputed() && (batchQuery.getSession().getPlatform().isLobCompatibleWithDistinct() || !Helper.hasLob(batchQuery.getDescriptor().getSelectionFields((ObjectLevelReadQuery)batchQuery)))) { ((ObjectLevelReadQuery)batchQuery).useDistinct(); } } if (this.mechanism != null) { this.mechanism.postPrepareNestedBatchQuery(batchQuery, query); } }