Fixed query method for multiple entities