Expression whereClause = null;
Expression builder = new ExpressionBuilder();
Iterator<DatabaseField> itPrimaryKey = m_descriptor.getPrimaryKeyFields().iterator();
while (itPrimaryKey.hasNext()) {
DatabaseField primaryKey = itPrimaryKey.next();
Expression expression = builder.getField(primaryKey).equal(builder.getParameter(primaryKey));
whereClause = expression.and(whereClause);
m_unmappedFieldsQuery.addArgument(primaryKey.getQualifiedName());
}
SQLSelectStatement statement = new SQLSelectStatement();
Iterator<DatabaseField> itUnmappedFields = m_unmappedQueryKeyFields.values().iterator();
while (itUnmappedFields.hasNext()) {
DatabaseField field = itUnmappedFields.next();
statement.addField(field);
}
statement.setWhereClause(whereClause);
statement.normalize(uow.getParent(), m_descriptor);