title: How to cast a RepositoryItem to an Order on ATG
body: <p>I'm new to ATG and I'm failing to do something that looks fairly simple.</p>
  
  <p>I'm trying to get an Order in the database by the number of the order. But this number is not the orderId so I can't just use the OrderManager.loadOrder method.</p>
  
  <p>This is the code I have so far:</p>
  
  <pre><code>Repository orderRepository = getOrderManager().getOrderTools().getOrderRepository();
  RepositoryView view = orderRepository.getView("order");
  
  RqlStatement statement = RqlStatement.parseRqlStatement("orderNumber EQUALS ?0");
  Object params[] = { pOrderNumber };
  RepositoryItem items[] = statement.executeQuery(view, params);
  
  RepositoryItem order = null;
  if( (items != null) &amp;&amp; (items.length &gt; 0) ) {
      order = items[0];
  }
  
  //Now I want to convert this order of type "RepositoryItem" to an actual Order object
  </code></pre>
  
  <p>I can do this by getting the repository ID and calling loadOrder form the OrderManager, but that seems like going back to the database and finding again what I already have in my hands.</p>
  
  <p>Is there another way to get an actual Order object out of this RepositoryItem object?</p>