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.  [ 1 post ] 
Author Message
 Post subject: Wrong column type: description, expected: varchar(65535)
PostPosted: Wed Oct 22, 2008 3:03 am 
Newbie

Joined: Wed Feb 01, 2006 9:05 am
Posts: 4
I am reverse engineering my annotated POJO's from a MySQL database schema. The table (simplified for the purpose of brevity) has the following field:

component
------------
...
description | text
...

The Hibernate reverse engineering tools created this in the POJO:

@Entity
@Table(name="component")
public class Component implements java.io.Serializable {

....

@Column(name="description", length=65535)
public String getDescription() {
return this.description;
}

....
}

That's fine because the 'text' MySQL datatype is effectively a VARCHAR(65535). However, now when I startup my webapp, running in Tomcat 5, using MySQL 5 JDBC JAR file and org.hibernate.dialect.MySQL5Dialect, I get the error indicated in the subject line above.

Full stack trace is:
Caused by: org.hibernate.HibernateException: Wrong column type: description, expected: varchar(65535)
at org.hibernate.mapping.Table.validateColumns(Table.java:261)
at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:1083)
at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:116)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:317)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1294)
at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:915)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.newSessionFactory(LocalSessionFactoryBean.java:799)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:733)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1257)
... 50 more

I've tried on suggestion which was to subclass the dialect class and register the varchar type as text, but that didn't help. Still get the exception. Can anybody shed light on the cause of my problem. Please. Any help appreciated as this is really frustrating me right now.

Many thanks,
Darryl Pentz


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

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.