title: MySQL to JPQL Inner Join
body: <p>I'm new to JPQL and struggling a bit to translate my SQL to JPQL. I have a simple query which works on MYSQL:</p>
  
  <pre><code>SELECT askorder.price, bidorder.price from OrderBook JOIN askorder 
  ON OrderBook.ASKORDERID_ORDERID = askorder.ORDERID
  JOIN bidorder ON OrderBook.BIDORDERID_ORDERID = bidorder.ORDERID
  WHERE askorder.ORDERID = 2;
  </code></pre>
  
  <p>I've attempted to translate this to JPQL but I'm sure it's wrong. Specifically I think it may be the ON keyword, I'm not sure how to translate that to JPQL:</p>
  
  <pre><code>@NamedQuery(
      name="findOrderBooksPrices",
      query="SELECT ao.price, bo.price from OrderBook bo, OrderBook ao" +
      "INNER JOIN ao ON bo.ASKORDERID_ORDERID = ao.ORDERID " + 
      "INNER JOIN bo ON OrderBook.BIDORDERID_ORDERID = bo.ORDERID " +
      "WHERE ao.ORDERID = :askOrderId"
  )
  </code></pre>
  
  <p>The error I get is:</p>
  
  <pre><code>Internal Exception: Exception [EclipseLink-7158] (Eclipse Persistence
  Services - 2.5.0.v20130507-3faac2b): 
  org.eclipse.persistence.exceptions.ValidationException
  Exception Description: Error encountered when building the @NamedQuery
  [findOrderBooksPrices] from entity class [class  
  org.eclipse.persistence.internal.jpa.metadata.queries.
  NamedQueryMetadata].Internal Exception: java.lang.ClassCastException: 
  org.eclipse.persistence.jpa.jpql.parser.NullExpression cannot be cast to 
  org.eclipse.persistence.jpa.jpql.parser.IdentificationVariable. Please
  see server.log for more details.
  </code></pre>
  
  <p>I'd like it to return the prices from each order table after submitting the order id.</p>
  
  <p>Thanks for looking.
  Cheers,
  Zerb</p>