Hi Abhinay,
Below is a sample code snippet which can used to achieve the similar functionality (as was with getPrimaryKeyValue()) in Mendix 7.x.
List<? extends IDataRow> dataRows = retrieveOQLDataTable.getRows();
IDataRow dataRow = dataRows.get(0); // For example, let us retrieve the first data row
IMendixIdentifier mendixIdentifier = dataRow.getValue(context, 0);
IMendixObject mendixObj = Core.retrieveId(context, mendixIdentifier);
Let me know if this helps you.
Add the Id as a column (0) and get that column, as an extra can check the type (IMendixIdentifier)
Edit 1:
From Module.Table AS TB
Select TB/ID, *
Yes this not as generic as your solution. Mendix also removed columnSchema.getMetaPrimitive() which I really need.