Hello,
I'm using Hibernate 3 with MySQL version 5.1.40.
In MySQL, I defined a column as TINYINT(1) and I tried mapping this in my hbm.xml file as a java.lang.Byte, but I kept getting the following exception:
Code:
org.hibernate.HibernateException: Wrong column type: priority, expected: tinyint
However, when I modified the column definition to TINYINT(2), the exception went away. Or if I modified the mapping to java.lang.Boolean, the exception would also go away. Any idea if this is a bug or not? My understanding is that the number in parentheses is for display purposes only. A TINYINT always uses the same storage space (1 byte) regardless of what the number in the parentheses is. Therefore, Hibernate shouldn't be forcing me to map a TINYINT(1) into a Boolean, especially since my column will hold values ranging from 1-5, which is why I chose TINYINT(1) instead of TINYINT(2).
Thanks in advance for any insight you can provide.