1

Resolved

Timestamp type auto-map incorrectly.

description

The all of TIMESTAMP or TIMESTAMP WITH TIMEZONE or TIMESTAMP WITH LOCAL TIMEZONE, auto-mapping incorrectly to System.String, it should be mapping to System.DateTime.

comments

jmarsch wrote Mar 17, 2013 at 8:31 PM

This doesn't seem to be working out. (I'm new to NHibernate, long-time Entity Framework user)

So, I have generated the class and the map. If I do a query like this:

from customer in session.Query<Customer>()
select customer;

I get an error Unable to cast object of type 'System.Byte[]' to type 'System.IConvertible'

Not positive, but pretty sure that a timestamp should be a byte[] (at the very least, if I change the generated code to byte[], I don't get exceptions when querying data)

stevenna wrote Nov 11, 2013 at 8:48 PM

this fix does not work with Timestamp(6)
it needs to be changed to something like this:
dataType.ToUpper().Contains("TIMESTAMP")

instead of this
string.Equals(dataType, "DATE", StringComparison.OrdinalIgnoreCase) ||
            string.Equals(dataType, "TIMESTAMP", StringComparison.OrdinalIgnoreCase) ||
            string.Equals(dataType, "TIMESTAMP WITH TIME ZONE", StringComparison.OrdinalIgnoreCase) ||
            string.Equals(dataType, "TIMESTAMP WITH LOCAL TIME ZONE", StringComparison.OrdinalIgnoreCase))