Skip to content

Invalid cast on nullable custom type with Linq #2437

Closed
@gokhanabatay

Description

@gokhanabatay

Hi,
We are trying to upgrade NH 5.3, that we have been waiting for along time.
We come across an issue, I implemented below test cases

https://github.com/gokhanabatay/NHibernateBugTest/blob/master/NHibernateBugTest/CustomTypeSelectFailsTest.cs

Get_DateCustomType_NullableDateValueEquals_IncorrectCast

select usersessio0_.GUID as guid1_5_, usersessio0_.MBR_ID as mbr2_5_, usersessio0_.USER_CODE as user3_5_, 
    usersessio0_.OPEN_DATE as open4_5_, usersessio0_.EXPIRE_DATE_TIME as expire5_5_,
    usersessio0_.IS_OPEN as is6_5_, usersessio0_.REMOTE_IP_ADDRESS as remote7_5_,
    usersessio0_.REMOTE_PORT as remote8_5_, usersessio0_.LOCAL_IP_ADDRESS as local9_5_,
    usersessio0_.LOCAL_PORT as local10_5_, usersessio0_.DEVICE_ID as device11_5_,
    usersessio0_.CLAIMS as claims12_5_ 
  from USER_SESSION usersessio0_
  where usersessio0_.MBR_ID = :p0 and cast(usersessio0_.OPEN_DATE as timestamp)=:p1 ]

Above sql includes cast(usersessio0_.OPEN_DATE as timestamp) but open_date is a number field in database. It is working with 5.2.7 and previous versions.

Get_BooleanCustomType_Fails_IncorrectCast

select cast(user1_.IS_OPEN as boolean) as col_0_0_
  from USER_SESSION usersessio0_
  left outer join ALL_USER user1_ on usersessio0_.USER_CODE=user1_.USER_CODE
  where usersessio0_.MBR_ID = :p0 and usersessio0_.OPEN_DATE=:p1 

Above sql includes cast(user1_.IS_OPEN as boolean) as col_0_0_ but is_open field is a number field. It is also working with 5.2.7 and previous versions.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions