[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1483?page=c...
]
David commented on HHH-1483:
----------------------------
I had this issue when running a native query. The dialect I was using was
MySQLInnoDBDialect.. It had an issue with a 'text' column. I subclassed
MySQLInnoDBDialect and did this
registerColumnType(Types.LONGVARCHAR, 65535, "text");
After debugging for a while I found it was actually getting the issue when going into
getHibernateTypeName, not getTypeName. Ths register method above affects getTypeName, not
getHibernateTypeName. Because of this I instead wrote
registerHibernateType(Types.LONGVARCHAR, 65535, "text");
This took care of my problem. Being the first time I have ever looked at Hibernate's
source I have no idea if this is what I should be doing. Looking further I believe the fix
to this issue (AGAIN 1st time looking at source) is to add the following to the
constructor of org.hibernate.dialect./Dialect (Note I didn't test this approach
but looking at the code it should surely fix the problem)
registerHibernateType( Types.LONGVARCHAR, Hibernate.STRING.getName() ); // TODO:
Check make sure the 2nd arg is right
I am not sure if the second argument is what it should be -- I really have no idea what
the difference between hibernateTypeNames and typeNames is suppose to be but I hope this
helps someone fix this issue.
In my opinion this is a large bug and should be high priority since "text" is a
very commonly used type and used by default when hibernate creates tables for you.
MySQL5: No Dialect mapping for JDBC type: -1
--------------------------------------------
Key: HHH-1483
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1483
Project: Hibernate3
Issue Type: Bug
Components: core
Affects Versions: 3.1.2
Environment: MySQL 5.0.18-nt
Reporter: Sergey Vladimirov
Priority: Minor
MySQL5: No Dialect mapping for JDBC type: -1
SELECT answpos,answer FROM votes_answers WHERE question=? ORDER BY answpos
mysql> describe votes_answers;
+----------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+---------+------+-----+---------+-------+
| question | int(11) | NO | MUL | | |
| answpos | int(11) | NO | | | |
| answer | text | YES | | NULL | |
+----------+---------+------+-----+---------+-------+
mysql> describe temp;
+---------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+---------+------+-----+---------+-------+
| answpos | int(11) | NO | | 0 | |
| answer | text | YES | | NULL | |
+---------+---------+------+-----+---------+-------+
Please, let me know what to add to MySQL5Dialect :)
Will it be ok to add? :
registerColumnType( Types.LONGVARCHAR, "text" );
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira