title: Comparing timestamps with mybatis, postgresql
body: <p>I'm using mybatis to query on my postgres DB, My problem is the comparaison between timestamps, i think it is not working properly since it doesn't retrun the needed results even it is not throwing any exception.
  Here is my code</p>
  
  <pre><code>&lt;select id="select_count" parameterType="map" resultType="map"&gt;
          select count(*) as count, TO_CHAR(created_on, #{xaxis}) as xaxis,state 
          from my_table
          where 1 = 1
          &lt;if test="fromdate != null"&gt; and created_on &amp;gt;= #{fromdate} &lt;/if&gt;
          &lt;if test="todate != null"&gt; and created_on &amp;lt;= #{todate} &lt;/if&gt;
          &lt;if test="state != null"&gt; and state = #{state} &lt;/if&gt;
          GROUP BY xaxis, state
  &lt;/select&gt;
  </code></pre>
  
  <p>and here is my java code</p>
  
  <pre><code>public List&lt;Map&lt;String, Object&gt;&gt; getStatesCount(Date fromDate,
                  Date toDate, String state, String xAxis) {
          Map&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;();
          params.put("fromdate", fromDate);
          params.put("todate", toDate);
          params.put("state", state);
          params.put("xaxis", "yyyy-mm-dd");
          List&lt;Map&lt;String, Object&gt;&gt; sqlResults = (List&lt;Map&lt;String, Object&gt;&gt;) template.selectList(SELECT_COUNT, params);
          return sqlResults;
      }
  </code></pre>
  
  <p>and this is the code for creating my_table</p>
  
  <pre><code>CREATE SEQUENCE my_table_seq START WITH 1 INCREMENT BY 1;
  CREATE TABLE my_table
  (
     id INT8 NOT NULL DEFAULT NEXTVAL('my_table_seq'),
     state VARCHAR(20),
     created_on TIMESTAMP WITH TIME ZONE,
     PRIMARY KEY (id),
  );
  </code></pre>
  
  <p>I know that my table has many rows with the 'created_on' prop set to , let's say, today's date. But when i pass my two date params or even one one of them , the select query doesn't return any data.</p>
  
  <p>So how to query properly with timestamps and <code>java.util.Date</code> ?</p>