I think I found a bug in Hibernate in the current release 3.5.3 used with mysql. I use mysql and a column is of type enum. When the
enum column has a valid alternative of a zero-length string I will get an exception:
could not read column value from result set String index out of range: 0
Code:
mysql> desc test;
+-------+-------------------
| Field | Type
+-------+-------------------
| id | int(11)
| a | enum('a','b,'c,'')
Session currentSession = HU.getSessionFactory().getCurrentSession();
String sql=" select * from test";
List result = currentSession.createSQLQuery(sql).list();
Iterator it = result.iterator();
Workaround: Use this sql instead to cast the enum to a char:
Code:
select id, cast(a as char) from test