title: EclipseLink - Invalid query key [latestVersionFlag] in expression
body: <p>I just upgraded from Toplink to EclipseLink and am running in to this error</p>
  
  <p>Exception [EclipseLink-6015] (Eclipse Persistence Services - 2.6.1.v20150916-55dc7c3): org.eclipse.persistence.exceptions.QueryException Exception Description: Invalid query key [latestVersionFlag] in expression. Query: ReadAllQuery(name="bookingVersionCollection" referenceClass=BookingVersion )</p>
  
  <p>My descriptor looks like this </p>
  
  <pre><code>OneToManyMapping bookingVersionCollectionMapping = new OneToManyMapping();
  bookingVersionCollectionMapping.setAttributeName("bookingVersionCollection");
  bookingVersionCollectionMapping.setReferenceClass(BookingVersion.class);
  bookingVersionCollectionMapping.useTransparentCollection();
  bookingVersionCollectionMapping.useCollectionClass(IndirectList.class);
  bookingVersionCollectionMapping.addAscendingOrdering("bookingVersionID");
  bookingVersionCollectionMapping.addTargetForeignKeyFieldName("RS_BOOKINGVERSION.RS_BKG_ID", "RS_BOOKING.RS_BKG_ID");
  bookingVersionCollectionMapping.setSelectionCriteria(bookingVersionCollectionMapping.buildSelectionCriteria()
      .and(expBuilder.get("latestVersionFlag").equal(ResConstants.FLAG_YES)));
  descriptor.addMapping(bookingVersionCollectionMapping);
  </code></pre>
  
  <p>I also have a mapping for BookingVersion class that has the mapping for that field</p>
  
  <pre><code>DirectToFieldMapping latestVersionFlagMapping = new DirectToFieldMapping();
  latestVersionFlagMapping.setAttributeName("latestVersionFlag");
  latestVersionFlagMapping.setFieldName("RS_BOOKINGVERSION.LATESTVERSIONFLAG");
  descriptor.addMapping(latestVersionFlagMapping);
  </code></pre>
  
  <p>And inside the Java poco object of BookingVersion.java that field looks like this..</p>
  
  <pre><code>private char latestVersionFlag = ResConstants.FLAG_YES;
  </code></pre>
  
  <p>Any ideas? This code worked in Toplink, so not sure what's going on.</p>