Search in sources :

Example 1 with TnRelationKeyCompound

use of org.dbflute.s2dao.rowcreator.impl.TnRelationKeyCompound in project dbflute-core by dbflute.

the class TnRelationRowCache method doCreateRelationKeyCompound.

protected TnRelationKey doCreateRelationKeyCompound(ResultSet rs, TnRelationPropertyType rpt, Map<String, String> selectColumnMap, Map<String, Map<String, Integer>> selectIndexMap, String relationNoSuffix) throws SQLException {
    final List<TnPropertyType> uniquePropertyTypeList = rpt.getUniquePropertyTypeList();
    Map<String, Object> relKeyValues = null;
    for (TnPropertyType pt : uniquePropertyTypeList) {
        final String columnKeyName = buildColumnKeyName(pt, relationNoSuffix);
        final Object keyValue = setupKeyElement(rs, rpt, selectColumnMap, selectIndexMap, columnKeyName, pt, relationNoSuffix);
        if (keyValue == null) {
            if (relKeyValues != null) {
                relKeyValues.clear();
            }
            // if either one is null, treated as no data
            break;
        }
        if (relKeyValues == null) {
            // lazy-load for performance
            relKeyValues = new HashMap<String, Object>(uniquePropertyTypeList.size());
        }
        relKeyValues.put(columnKeyName, keyValue);
    }
    return (relKeyValues != null && !relKeyValues.isEmpty()) ? new TnRelationKeyCompound(relKeyValues) : null;
}
Also used : TnRelationKeyCompound(org.dbflute.s2dao.rowcreator.impl.TnRelationKeyCompound) TnPropertyType(org.dbflute.s2dao.metadata.TnPropertyType)

Aggregations

TnPropertyType (org.dbflute.s2dao.metadata.TnPropertyType)1 TnRelationKeyCompound (org.dbflute.s2dao.rowcreator.impl.TnRelationKeyCompound)1