on change of refrence selector call the same MF in which you are executing your OQL statement and pass string parameter
now place a decision in MF and check condition like $yourEntityobject/selectedAttribute name !=empty if true execute another OQL Statement and Get data filtered by your selected attribute
else
retreive all data showing in datagrid (by default).
make sure datagrid refresh interval should be set.
The OQL doesn't retrieve the "real" objects from your database but rather reads data from DB and creates helper objects filled with the data read from the DB. When using OQL for such UseCases as you do, my approach is always: