Generate TOs from Query