@Override
    public VmTemplate mapRow(ResultSet rs, int rowNum) throws SQLException {
      final VmTemplate entity = new VmTemplate();
      map(rs, entity);

      entity.setId(getGuidDefaultEmpty(rs, "vmt_guid"));
      entity.setChildCount(rs.getInt("child_count"));
      entity.setName(rs.getString("name"));
      entity.setVdsGroupId(getGuid(rs, "vds_group_id"));
      entity.setAllowConsoleReconnect(rs.getBoolean("allow_console_reconnect"));
      entity.setStatus(VmTemplateStatus.forValue(rs.getInt("status")));
      entity.setVdsGroupName(rs.getString("vds_group_name"));
      entity.setStoragePoolId(getGuid(rs, "storage_pool_id"));
      entity.setStoragePoolName(rs.getString("storage_pool_name"));
      entity.setQuotaName(rs.getString("quota_name"));
      entity.setQuotaEnforcementType(
          QuotaEnforcementTypeEnum.forValue(rs.getInt("quota_enforcement_type")));
      entity.setDisabled(rs.getBoolean("is_disabled"));
      entity.setTrustedService(rs.getBoolean("trusted_service"));
      entity.setTemplateType(VmEntityType.valueOf(rs.getString("entity_type")));
      entity.setClusterArch(ArchitectureType.forValue(rs.getInt("architecture")));
      entity.setBaseTemplateId(getGuidDefaultEmpty(rs, "base_template_id"));
      entity.setTemplateVersionNumber(rs.getInt("template_version_number"));
      entity.setTemplateVersionName(rs.getString("template_version_name"));
      return entity;
    }