How do we retrieve desired filed from any mapper so as to use it in Query parameter.
In my case i want to find records where my 'desired-field' is having value = somevalue.
It tried the following way
foo(Users)
// foo defined here...
def foo ( modelObject:Mapper[_])={
var field =modelObject.fieldByName("UserName").openTheBox.asInstanceOf[MappedField[_,Users]]
var requiredUser = modelObject.find(By(field, "dummyUser")
}
but then it forces me to specify the actual Mapper in the asInstanceOf[MappedField[_,Users]]
( Users instance is passed here ). I want to make it work for any Mapper and not just 'Users'.
It doesn't work with asInstanceOf[MappedField[_,_]]
I understand that each Mapper may not have the field that i want and In that case if the .fieldByName()
function should throw some exception, it's acceptable. But at least for those having the filed, it should work.
can anyone help me in this...