nhibernate / fluent-nhibernate

Fluent NHibernate!
BSD 3-Clause "New" or "Revised" License
1.66k stars 686 forks source link

Error in command when using the formula property for CAST in DB2 #690

Open LendaUrbana opened 3 months ago

LendaUrbana commented 3 months ago

I am using the mapping below with the formula property, to perform a CAST on a field in a DB2 database. However, when the command is generated, it is invalid because it is including the alias incorrectly as shown below.

Map(c => c.wdesc).CustomType().Formula("CAST(wdesc as VARCHAR(30) CCSID 37)").Length(30).Not.Nullable()

Same error Map(c => c.wdesc).Formula("CAST(wdesc as VARCHAR(30) CCSID 37)").Length(30).Not.Nullable()

Field with command error (CAST(ilm4.wdesc as VARCHAR(30) ilm4.CCSID 37))

The alias is being inserted in the CCSID and is not necessary in these cast cases

For working correct (CAST(ilm4_.wdesc as VARCHAR(30) CCSID 37))

I'm using the latest versions of hibernate and fluence hibernate , and I tested with older versions and the same error occurs.