title: Property comparison query with date object returns object while properties don't match
body: <p>I have a domain class in <code>Grails</code> as follows:</p>
  
  <pre><code>class ActivityEvent
  {
      String activityName 
      Date startTimeStamp
      Date endTimeStamp
      Client client
  
      static belongsTo = [client: Client]
  
      static constraints = {
          activityName            nullable:false, blank:false, size: 0..50
          startTimeStamp          nullable:false
          endTimeStamp            nullable:false
          client                  nullable:false
      }
  }
  </code></pre>
  
  <p>where <code>Client</code> is another domain class.</p>
  
  <p>In my test I save 2 <code>ActivityEvent</code> objects to the db:</p>
  
  <pre><code>Date now = new Date()
  Client c = Client.get("1")
  new ActivityEvent(client: c, activityName: "test", startTimeStamp: new Date(now.getTime()), endTimeStamp: new Date(now.getTime())).save(failOnError: true)
  new ActivityEvent(client: c, activityName: "test", startTimeStamp: new Date(now.getTime()), endTimeStamp: new Date(now.getTime() + 5 * 60 * 1000)).save(failOnError: true)
  </code></pre>
  
  <p>Now when I execute (with <code>c</code> and <code>name</code> being parameters to this method)</p>
  
  <pre><code>ActivityEvent.findAll {
      client == c &amp;&amp;
      activityName == name &amp;&amp;
      startTimeStamp == endTimeStamp
  }
  </code></pre>
  
  <p>My resultset is this:</p>
  
  <pre><code>[
    ActivityEvent - name:test from Mon Oct 27 09:37:56 CET 2014 to Mon Oct 27 09:42:56 CET 2014,
    ActivityEvent - name:test from Mon Oct 27 09:47:56 CET 2014 to Mon Oct 27 09:47:56 CET 2014
  ]
  </code></pre>
  
  <p>As you can see the resultset contains an <code>ActivityEvent</code> with the <code>startTimeStamp</code> not being equal to the <code>endTimeStamp</code> while I did specify this in my query that they need to be equal.</p>
  
  <p>When I run the same query using <code>where</code></p>
  
  <pre><code>ActivityEvent.where {
      client == c &amp;&amp;
      activityName == name &amp;&amp;
      startTimeStamp == endTimeStamp        
  }.find()
  </code></pre>
  
  <p>I get an exception <code>org.hibernate.NonUniqueResultException: query did not return a unique result: 2</code> which is no surprise since the <code>findAll</code> also returns 2 objects.</p>
  
  <p>Am I missing something or doing something wrong in the query? According to the printout of the resultset one item shouldn't have matched the query.</p>