Java Code Examples for org.apache.ibatis.mapping.ResultMap#hasNestedResultMaps()

The following examples show how to use org.apache.ibatis.mapping.ResultMap#hasNestedResultMaps() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Configuration.java    From Shop-for-JavaWeb with MIT License 6 votes vote down vote up
protected void checkGloballyForDiscriminatedNestedResultMaps(ResultMap rm) {
	if (rm.hasNestedResultMaps()) {
		for (Map.Entry<String, ResultMap> entry : resultMaps.entrySet()) {
			Object value = entry.getValue();
			if (value instanceof ResultMap) {
				ResultMap entryResultMap = (ResultMap) value;
				if (!entryResultMap.hasNestedResultMaps()
						&& entryResultMap.getDiscriminator() != null) {
					Collection<String> discriminatedResultMapNames = entryResultMap
							.getDiscriminator().getDiscriminatorMap()
							.values();
					if (discriminatedResultMapNames.contains(rm.getId())) {
						entryResultMap.forceNestedResultMaps();
					}
				}
			}
		}
	}
}
 
Example 2
Source File: Configuration.java    From Shop-for-JavaWeb with MIT License 6 votes vote down vote up
protected void checkLocallyForDiscriminatedNestedResultMaps(ResultMap rm) {
	if (!rm.hasNestedResultMaps() && rm.getDiscriminator() != null) {
		for (Map.Entry<String, String> entry : rm.getDiscriminator()
				.getDiscriminatorMap().entrySet()) {
			String discriminatedResultMapName = entry.getValue();
			if (hasResultMap(discriminatedResultMapName)) {
				ResultMap discriminatedResultMap = resultMaps
						.get(discriminatedResultMapName);
				if (discriminatedResultMap.hasNestedResultMaps()) {
					rm.forceNestedResultMaps();
					break;
				}
			}
		}
	}
}
 
Example 3
Source File: Configuration.java    From mybaties with Apache License 2.0 6 votes vote down vote up
protected void checkGloballyForDiscriminatedNestedResultMaps(ResultMap rm) {
  if (rm.hasNestedResultMaps()) {
    for (Map.Entry<String, ResultMap> entry : resultMaps.entrySet()) {
      Object value = entry.getValue();
      if (value instanceof ResultMap) {
        ResultMap entryResultMap = (ResultMap) value;
        if (!entryResultMap.hasNestedResultMaps() && entryResultMap.getDiscriminator() != null) {
          Collection<String> discriminatedResultMapNames = entryResultMap.getDiscriminator().getDiscriminatorMap().values();
          if (discriminatedResultMapNames.contains(rm.getId())) {
            entryResultMap.forceNestedResultMaps();
          }
        }
      }
    }
  }
}
 
Example 4
Source File: Configuration.java    From mybatis with Apache License 2.0 6 votes vote down vote up
protected void checkGloballyForDiscriminatedNestedResultMaps(ResultMap rm) {
  if (rm.hasNestedResultMaps()) {
    for (Map.Entry<String, ResultMap> entry : resultMaps.entrySet()) {
      Object value = entry.getValue();
      if (value instanceof ResultMap) {
        ResultMap entryResultMap = (ResultMap) value;
        if (!entryResultMap.hasNestedResultMaps() && entryResultMap.getDiscriminator() != null) {
          Collection<String> discriminatedResultMapNames = entryResultMap.getDiscriminator().getDiscriminatorMap().values();
          if (discriminatedResultMapNames.contains(rm.getId())) {
            entryResultMap.forceNestedResultMaps();
          }
        }
      }
    }
  }
}
 
Example 5
Source File: Configuration.java    From mybaties with Apache License 2.0 5 votes vote down vote up
protected void checkLocallyForDiscriminatedNestedResultMaps(ResultMap rm) {
  if (!rm.hasNestedResultMaps() && rm.getDiscriminator() != null) {
    for (Map.Entry<String, String> entry : rm.getDiscriminator().getDiscriminatorMap().entrySet()) {
      String discriminatedResultMapName = entry.getValue();
      if (hasResultMap(discriminatedResultMapName)) {
        ResultMap discriminatedResultMap = resultMaps.get(discriminatedResultMapName);
        if (discriminatedResultMap.hasNestedResultMaps()) {
          rm.forceNestedResultMaps();
          break;
        }
      }
    }
  }
}
 
Example 6
Source File: DefaultResultSetHandler.java    From mybaties with Apache License 2.0 5 votes vote down vote up
private void handleRowValues(ResultSetWrapper rsw, ResultMap resultMap, ResultHandler resultHandler, RowBounds rowBounds, ResultMapping parentMapping) throws SQLException {
  if (resultMap.hasNestedResultMaps()) {
    ensureNoRowBounds();
    checkResultHandler();
    handleRowValuesForNestedResultMap(rsw, resultMap, resultHandler, rowBounds, parentMapping);
  } else {
    handleRowValuesForSimpleResultMap(rsw, resultMap, resultHandler, rowBounds, parentMapping);
  }
}
 
Example 7
Source File: Configuration.java    From mybatis with Apache License 2.0 5 votes vote down vote up
protected void checkLocallyForDiscriminatedNestedResultMaps(ResultMap rm) {
  if (!rm.hasNestedResultMaps() && rm.getDiscriminator() != null) {
    for (Map.Entry<String, String> entry : rm.getDiscriminator().getDiscriminatorMap().entrySet()) {
      String discriminatedResultMapName = entry.getValue();
      if (hasResultMap(discriminatedResultMapName)) {
        ResultMap discriminatedResultMap = resultMaps.get(discriminatedResultMapName);
        if (discriminatedResultMap.hasNestedResultMaps()) {
          rm.forceNestedResultMaps();
          break;
        }
      }
    }
  }
}
 
Example 8
Source File: DefaultResultSetHandler.java    From mybatis with Apache License 2.0 5 votes vote down vote up
private void handleRowValues(ResultSetWrapper rsw, ResultMap resultMap, ResultHandler resultHandler, RowBounds rowBounds, ResultMapping parentMapping) throws SQLException {
  if (resultMap.hasNestedResultMaps()) {
    ensureNoRowBounds();
    checkResultHandler();
    handleRowValuesForNestedResultMap(rsw, resultMap, resultHandler, rowBounds, parentMapping);
  } else {
    handleRowValuesForSimpleResultMap(rsw, resultMap, resultHandler, rowBounds, parentMapping);
  }
}