fix to_json issue and an more powerful findBysql


1 to_json doesn't work if multiple children exists;
2 old findBySql only returns current Model, but this doesn't work in the following scenario:
  class AModel extends Model {};
  class BModel extends Model {
       public <T extends Model> T getPeer() {
            // return Model.findBySql(query, parameters); // this doesn't work, always return BModel. No way to call AModel aModel = bModel.getPeer();
             return Model.findBySql(AModel.class,query,parameters); // this works
       }
  };