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

Nikita Timofeev commented on CAY-2058:
--------------------------------------

Mapping in DATE and TIME types mapping were changed from *datetime* to *time* 
and *date* accordingly per CAY-2189.

As of December 2016 the following versions are supported by Microsoft:
 * SQL Server 2008
 * SQL Server 2008 R2
 * SQL Server 2012
 * SQL Server 2014
 * SQL Server 2016

Also keep in mind that types.xml mapping is only for creating database 
structure in tests and database merging and is not recommended for usage with 
production.

> 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: Savva Kolbachev
>
> 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)

Reply via email to