Skip to content

NH-3254 - DateTime vs Date/Timestamp in Oracle #741

Open
@nhibernate-bot

Description

@nhibernate-bot

stigchristensen created an issue — 31st August 2012, 7:03:22:

The Oracle dialect maps DateTime to DbType.DateTime. This is a good choice if you are using the Oracle timestamp.

When using Oracle Date this is not at good mapping because Oracle will not use the index resulting in slow queries. If you instead use the DbType.Date (NHibernate.Type.DateType) the index will work but the time part would be removed. A Oracle Date has a time part.

To fix this we need another date type like the custom one posted here.

https://groups.google.com/group/nhusers/browse_thread/thread/1e68220bcafcf28c


edmaher added a comment — 2nd December 2014, 2:28:04:

This is actually a Major issue.
In Oracle10g Dialect derived from Oracle9i Dialect, the DateTime type is mapped to TIMESTAMP(4) which is unexpected. I suspect that many users will have databases using column type DATE and expecting DateTime to work.
The way that this causes a problem is not immediately obvious and hard to locate.
I am wondering what the rationale is to use TIMESTAMP(4) in NHibernate, perhaps for timestamp comparison capability ?


stigchristensen added a comment — 9th June 2017, 11:30:18:

see fix here

https://github.com/stigc/FixOracleDatesNotUsingIndex

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions