/** * Gets the column value map recursive. * * @param entity the entity * @param mapping the mapping * @return the column value map recursive * @throws ClassNotFoundException the class not found exception * @throws SQLException the sQL exception * @throws InstantiationException the instantiation exception * @throws IllegalAccessException the illegal access exception * @throws InvocationTargetException the invocation target exception * @throws NoSuchMethodException the no such method exception */ public Map<String, ColumnValue> getColumnValueMapRecursive(Object entity, ObjectMapping mapping) throws ClassNotFoundException, SQLException, InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException { Map<String, ColumnValue> parentMap = getColumnValueMap(entity, mapping); Map<String, ColumnValue> childMap = null; List<PropertyMapping> complexPropertyList = mapping.getComplexPropertyMappingList(); ObjectMapping childMapping = null; Object object = null; for (PropertyMapping pm : complexPropertyList) { if (!filter(pm)) { continue; } if (entity == null) { object = null; } else { object = PropertyUtils.getProperty(entity, pm.getPropertyName()); } childMapping = EntityMappingFactory.getObjectMapping(pm.getPropertyClass()); childMap = getColumnValueMapRecursive(object, childMapping); for (Entry<String, ColumnValue> entry : childMap.entrySet()) { if (pm.isPrimaryKey()) { entry.getValue().setPrimaryKey(true); } if (!parentMap.containsKey(entry.getKey())) { parentMap.put(entry.getKey(), entry.getValue()); } } } return parentMap; }