-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: MySQL5InnoDBDialect Found: text, expected: varchar(65535)
PostPosted: Mon May 17, 2010 4:26 am 
Pro
Pro

Joined: Mon Apr 16, 2007 8:10 am
Posts: 246
I have an issue when using the dialect

org.hibernate.dialect.MySQL5InnoDBDialect

instead of the dialect

org.hibernate.dialect.MySQLDialect

When using the dialect MySQL5InnoDBDialect I get the following error:

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.878 sec <<< FAILURE!
testInsert(com.thalasoft.learnintouch.core.dao.PreferenceDaoTest) Time elapsed: 2.87 sec <<< ERROR!
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [spring-hibernate.xml]: Invocation of init method failed; nested exception is org.hibernate.HibernateException: Wrong column type in db_thalasoft.admin for column profile. Found: text, expected: varchar(65535)

But my MySql version is:

mysql> SHOW VARIABLES LIKE "%version%";
+-------------------------+------------------------------+
| Variable_name | Value |
+-------------------------+------------------------------+
| protocol_version | 10 |
| version | 5.0.45 |
| version_comment | MySQL Community Server (GPL) |
| version_compile_machine | i686 |
| version_compile_os | pc-linux-gnu |
+-------------------------+------------------------------+
5 rows in set (0.00 sec)

And my table is an InnoDB one:

mysql> show create table preference;
+------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table |
+------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| preference | CREATE TABLE `preference` (
`id` int(10) unsigned NOT NULL auto_increment,
`version` int(10) unsigned NOT NULL,
`name` varchar(50) NOT NULL,
`is_ml_text` varchar(1) NOT NULL,
`value` text NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
UNIQUE KEY `id` (`id`),
KEY `name_2` (`name`)
) ENGINE=InnoDB AUTO_INCREMENT=435 DEFAULT CHARSET=latin1 |
+------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

Why using the dialect org.hibernate.dialect.MySQL5InnoDBDialect gives such an error ?


Top
 Profile  
 
 Post subject: Re: MySQL5InnoDBDialect Found: text, expected: varchar(65535)
PostPosted: Mon May 17, 2010 4:48 am 
Pro
Pro

Joined: Mon Apr 16, 2007 8:10 am
Posts: 246
I solved the issue.

I had a mapping like

Code:
        <property name="profile" type="string">
            <column name="profile" length="65535" not-null="true" />
        </property>


which the dialect MySQLDialect seemed to be happy with.

So I changed it to

Code:
        <property name="profile" type="text">
            <column name="profile" length="65535" not-null="true" />
        </property>


and now the dialect MySQL5InnoDBDialect is also happy.

Probably the dialect MySQL5InnoDBDialect does a stricter validating job.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.