GetValueOrDefault() is broken for DateTime?

Description

I have an Oracle table with a Date data type called TEST_DATE. When I try to do:

1 2 3 Session.Query<StdntAsesmnt>.Where(x => x.StdntKey == studntKey)..Select(x => x.TestDate.GetValueOrDefault() }) .ToList());

NHibernate.Exceptions.GenericADOException: could not execute query
[ select nvl(stdntasesm0_.TEST_DATE, '1/1/0001 12:00:00 AM') as col_0_0_, stdntasesm0_.TEST_DATE as col_1_0_ from EAS_ADMIN.STDNT_ASESMNT stdntasesm0_ where stdntasesm0_.STDNT_KEY=0 order by stdntasesm0_.ASESMNT_SUBJCT_KEY asc ]
Name1 - Value:261870
[SQL: select nvl(stdntasesm0_.TEST_DATE, '1/1/0001 12:00:00 AM') as col_0_0_, stdntasesm0_.TEST_DATE as col_1_0_ from EAS_ADMIN.STDNT_ASESMNT stdntasesm0_ where stdntasesm0_.STDNT_KEY=0 order by stdntasesm0_.ASESMNT_SUBJCT_KEY asc] ---> Oracle.DataAccess.Client.OracleException: ORA-01843: not a valid month
Result StandardOutput: NHibernate: select nvl(stdntasesm0_.TEST_DATE, '1/1/0001 12:00:00 AM') as col_0_0_, stdntasesm0_.TEST_DATE as col_1_0_ from EAS_ADMIN.STDNT_ASESMNT stdntasesm0_ where stdntasesm0_.STDNT_KEY=0 order by stdntasesm0_.ASESMNT_SUBJCT_KEY asc;0 = 261870 [Type: Int32 (0)]

This works in NHibernate 3.1 which gives me
select nvl(stdntasesm0_.TEST_DATE, to_date('1/1/0001 12:00:00 AM', 'mm/DD/yyyy hh:MI:ss AM')

The generated SQL needs the to_date function to be valid.

Environment

NHibernate 4.0.3.4000
FluentNHibernate 2.0.1.0
Oracle 11.2
Visual Studio 2013

Status

Assignee

Unassigned

Reporter

Kevin Low

Labels

Components

Affects versions

4.0.3

Priority

Minor
Configure