You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cayenne.apache.org by "Savva Kolbachev (JIRA)" <ji...@apache.org> on 2017/01/21 13:13:27 UTC

[jira] [Updated] (CAY-2058) Treating TIME jdbc-type as datetime db-type for MS SQL Server

     [ https://issues.apache.org/jira/browse/CAY-2058?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Savva Kolbachev updated CAY-2058:
---------------------------------
    Assignee: Nikita Timofeev  (was: Savva Kolbachev)

> Treating TIME jdbc-type as datetime db-type for MS SQL Server
> -------------------------------------------------------------
>
>                 Key: CAY-2058
>                 URL: https://issues.apache.org/jira/browse/CAY-2058
>             Project: Cayenne
>          Issue Type: Bug
>    Affects Versions: 4.0.M2, 4.0.M3
>            Reporter: Savva Kolbachev
>            Assignee: Nikita Timofeev
>             Fix For: 4.0.M5
>
>
> Relates to the failed test DataContextEJBQLDateTimeFunctionalExpressionsIT.testCURRENT_TIME:85
> We treats TIME jdbc-type as datetime db-type for MS SQL Server:
> {code:xml}
>    <jdbc-type name="TIME">
>        <db-type name="datetime"/>
>    </jdbc-type>
> {code}
> For testCURRENT_TIME we have the following insertion query:
> {noformat}
> INSERT INTO DATE_TEST (DATE_COLUMN, DATE_TEST_ID, TIMESTAMP_COLUMN, TIME_COLUMN) VALUES (?, ?, ?, ?)
> [batch bind: 1->DATE_COLUMN:NULL, 2->DATE_TEST_ID:220, 3->TIMESTAMP_COLUMN:NULL, 4->TIME_COLUMN:'2016-02-01 23:59:59.753']
> [batch bind: 1->DATE_COLUMN:NULL, 2->DATE_TEST_ID:221, 3->TIMESTAMP_COLUMN:NULL, 4->TIME_COLUMN:'2016-02-01 00:00:00.753']
> {noformat}
> But actually in the database we have:
> {noformat}
> TIME_COLUMN (datetime)
> 1970-01-01 00:00:00.383
> 1970-01-01 23:59:59.383
> {noformat}
> Then testCURRENT_TIME compare time column with current time and fails.
> {noformat}
> SELECT t0.DATE_COLUMN AS ec0_0, t0.TIME_COLUMN AS ec0_1, t0.TIMESTAMP_COLUMN AS ec0_2, t0.DATE_TEST_ID AS ec0_3 FROM DATE_TEST t0 WHERE t0.TIME_COLUMN < {fn CURTIME()}
> {noformat}
> Treating TIME jdbc-type as time db-type solves this problem, but it also breaks backward compatibility with 2005 version. MS SQL Server has supported time db-type since 2008 version.



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