[ 
https://issues.apache.org/jira/browse/METAMODEL-198?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14962438#comment-14962438
 ] 

ASF GitHub Bot commented on METAMODEL-198:
------------------------------------------

Github user kaspersorensen commented on a diff in the pull request:

    https://github.com/apache/metamodel/pull/58#discussion_r42322079
  
    --- Diff: 
jdbc/src/main/java/org/apache/metamodel/jdbc/dialects/DefaultQueryRewriter.java 
---
    @@ -139,13 +143,24 @@ public String rewriteFilterItem(FilterItem item) {
                         }
                     }
     
    -                FilterItem replacementFilterItem = new 
FilterItem(item.getSelectItem(), item.getOperator(), elements);
    +                FilterItem replacementFilterItem = new 
FilterItem(selectItem, item.getOperator(), elements);
                     return super.rewriteFilterItem(replacementFilterItem);
                 }
             }
             return super.rewriteFilterItem(item);
         }
    -    
    +
    +    protected String rewriteTimestamp(FilterItem item) {
    --- End diff --
    
    Now this method does a rewrite of a whole filter item and not just the 
timestamp literal. I was suggesting to make something that would make the 
burden of overriding as little as possible, so that you would only need to do 
like this:
    
    ```
    protected String rewriteTimestamp(Timestamp timestamp) {
      return MyStrangeTimestampFormat.format(timestamp);
    } 
    ```


> Where clauses on timestamp loses the nanoseconds
> ------------------------------------------------
>
>                 Key: METAMODEL-198
>                 URL: https://issues.apache.org/jira/browse/METAMODEL-198
>             Project: Apache MetaModel
>          Issue Type: Bug
>            Reporter: Ankit Kumar
>
> Queries having where clause on timestamp column in databases loses the 
> nanoseconds. 
> This is happening because the Timestamp values are converted to Date object 
> using the new Date(long timeInMilliseconds).



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to