private int[] createIndexPositions(OrmQueryRequest<?> request, SqlTree sqlTree) { List<String> chain = sqlTree.buildSelectExpressionChain(); ColumnMapping columnMapping = request.getQuery().getRawSql().getColumnMapping(); int[] indexPositions = new int[chain.size()]; for (int i = 0; i < chain.size(); i++) { String expr = chain.get(i); int indexPos = 1 + columnMapping.getIndexPosition(expr); indexPositions[i] = indexPos; } return indexPositions; } }
private int[] createIndexPositions(OrmQueryRequest<?> request, SqlTree sqlTree) { List<String> chain = sqlTree.buildSelectExpressionChain(); ColumnMapping columnMapping = request.getQuery().getRawSql().getColumnMapping(); int[] indexPositions = new int[chain.size()]; for (int i = 0; i < chain.size(); i++) { String expr = chain.get(i); int indexPos = 1 + columnMapping.getIndexPosition(expr); indexPositions[i] = indexPos; } return indexPositions; } }
private int[] createIndexPositions(OrmQueryRequest<?> request, SqlTree sqlTree) { List<String> chain = sqlTree.buildRawSqlSelectChain(); ColumnMapping columnMapping = request.getQuery().getRawSql().getColumnMapping(); int[] indexPositions = new int[chain.size()]; // set the resultSet index positions for the property expressions for (int i = 0; i < chain.size(); i++) { String logicalPropertyPath = chain.get(i); int mappedPosition = columnMapping.getIndexPosition(logicalPropertyPath); if (mappedPosition == -1 && logicalPropertyPath.endsWith(".id")) { // try a automatically mapped foreign key mappedPosition = columnMapping.getIndexPosition(foreignKeyPath(logicalPropertyPath)); } indexPositions[i] = 1 + mappedPosition; } // check and handle the case where a discriminator column for // an associated bean is in the raw SQL but is mapped columnIgnore for (int i = 0; i < indexPositions.length; i++) { if (indexPositions[i] == 0) { if (i < indexPositions.length) { // expect discriminator column to immediately proceed id column indexPositions[i] = indexPositions[i + 1] - 1; } } } return indexPositions; }