Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

This question is just out of curiosity, fyi, for this application it makes no difference if I used short or byte, but I wanted to ask anyway.

When mapping a tinyint column to a byte property of an entity, I get this exception: Dialect does not support DbType.Byte. I'm using SA12.0.1 and NHibernate 3.1 with Glenn Paulley's dialect. I haven't upgraded to NH3.2 yet since FluentNH didn't catch up yet.

If I use a property of type short, it's ok, no complaints. In the documentation for tinyint, it's also stated that "Also, to send a TINYINT value to a database from an application written in C, the type of the C variable should be integer."

Since both SA tinyint and .Net byte are unsigned types ranging 0-255, why would not the former be assigned to the latter?

asked 07 Mar '12, 05:12

henginy's gravatar image

accept rate: 0%

I think the problem is simply that the mapping of BYTE to TINYINT isn't present in my dialect - an oversight on my part.

If you want that specific mapping, you can add the line

        RegisterColumnType(DbType.Byte, "TINYINT");

to the RegisterNumericTypeMappings()routine yourself, and then recompile the NHibernate DLL with Visual Studio.

I will submit this to the NHibernate forum as a bug, so that it can be corrected in a subsequent NHibernate distribution.

permanent link

answered 07 Mar '12, 10:35

Glenn%20Paulley's gravatar image

Glenn Paulley
accept rate: 43%


Thank you for taking the time. As a note to future readers, I managed to get it working without recompiling NH by adding the line you mentioned to SybaseSQLAnywhere12Dialect class constructor.

(07 Mar '12, 11:26) henginy
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 07 Mar '12, 05:12

question was seen: 4,872 times

last updated: 07 Mar '12, 11:27