title: Object returned from OQL query in jhat does not match query
body: <p>Our team has a Java process running (on a 64-bit server OpenJDK 1.8.0_171-b10) in which some unexplainable things happen regarding the value of (boxed) <code>Long</code> objects. We have created a heap dump to analyse with <code>jhat</code> and here something really strange occurs.</p>
  
  <p>Having <code>jhat</code> running, we issue one of the following OQL queries:</p>
  
  <ul>
  <li><code>select l from java.lang.Long l where l.value.toString().equals("20180919141719600")</code></li>
  <li><code>select l from java.lang.Long l where l.value == 20180919141719600</code></li>
  </ul>
  
  <p>Both result in the same three objects being returned. However, when we inspect the objects, all three have a different value in <code>value</code> and neither of those equals <code>20180919141719600</code>.</p>
  
  <ul>
  <li><a href="https://i.stack.imgur.com/1g0VA.png" rel="nofollow noreferrer">Screenshot of OQL query with results of three objects</a></li>
  <li><a href="https://i.stack.imgur.com/BM5eH.png" rel="nofollow noreferrer">Screenshot of details of one of the objects, showing a different value than used in the query</a></li>
  </ul>
  
  <p>This in itself bothers us and is the core of our question.</p>
  
  <p>Additionally, we can make the situation a bit more interesting. It seems as if the running Java code uses the actual values (as we see using <code>jhat</code> in the <code>value</code> field of the <code>Long</code> objects), except in JSON serialisation, because the REST endpoint returns the value <code>20180919141719600</code>. This signals that somehow both values are actually in memory (and heap dump) and somehow JSON serialisation (using Jackson) does something different, congruent to what <code>jhat</code> does when running OQL queries.</p>
  
  <p>What would be the next step to analyse this situation?</p>