creates queries with entity id