/** * Designed for use when a projection query is used. The fetch arguments * need prepended with the projection property name. * * @param entity The {@link PersistentEntity} being queried * @param projectionName The name of the property being projected */ public EntityFetchOptions(PersistentEntity entity, String projectionName) { if (entity == null) { throw new IllegalArgumentException("Cannot retrieve fetch options for a null entity. Is GORM initialized?"); } this.entity = entity; this.propertyName = projectionName; for (Association association : entity.getAssociations()) { associations.put(association.getName(), association); } associationNames = associations.keySet(); }
protected void initializeJoinStatus() { Boolean cachedStatus = JOIN_STATUS_CACHE.get(entity.getName()); if(cachedStatus != null) hasJoins = cachedStatus; else { for(Association a : entity.getAssociations()) { if( a.getFetchStrategy() == FetchType.EAGER ) hasJoins = true; } } }