public User getUser ( String fieldName , String fieldValue ) { Select q = new Select ( ) . from ( User . class ) ; String nameColumn = ModelReflector . instance ( User . class ) . getColumnDescriptor ( fieldName ) . getName ( ) ; q . where ( new Expression ( q . getPool ( ) , nameColumn , Operator . EQ , new BindVariable ( q . getPool ( ) , fieldValue ) ) ) ; List < ? extends User > users = q . execute ( User . class ) ; if ( users . size ( ) == 1 ) { return users . get ( 0 ) ; } return null ; }
Can be cast to any user model class as the proxy implements all the user classes .