If you are getting the following exception:
org.hibernate.HibernateException: Wrong column type...
when Hibernate 3.1 validates your MySQL 4.1 database schema using
<property name="hbm2ddl.auto">validate</property>
in your hibernate.cfg.xml
check whether you have custom sql-type in your Hibernate mappings and whether it is written in lower case as in example below (sql-type="mediumblob"
):
|
|
The exception
org.hibernate.HibernateException: Wrong column type: PHOTO_DATA, expected: MEDIUMBLOB at org.hibernate.mapping.Table.validateColumns(Table.java:219) at org.hibernate.cfg.Configuration.validateSchema(Configuration.java:964) at org.hibernate.tool.hbm2ddl.SchemaValidator.validate(SchemaValidator.java:116) at org.hibernate.impl.SessionFactoryImpl.(SessionFactoryImpl.java:296) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1154) at com.sac.ta.util.HibernateUtil. (HibernateUtil.java:91) at com.sac.ta.util.HibernateListener.contextInitialized(HibernateListener.java:32) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3692) at org.apache.catalina.core.StandardContext.start(StandardContext.java:4127) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524) at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:910) at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:873) at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:474) at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1118) at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:310) at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1020) at org.apache.catalina.core.StandardHost.start(StandardHost.java:718) at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012) at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442) at org.apache.catalina.core.StandardService.start(StandardService.java:450) at org.apache.catalina.core.StandardServer.start(StandardServer.java:680) at org.apache.catalina.startup.Catalina.start(Catalina.java:536) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:275) at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
happens if you use upper case instead of (sql-type="MEDIUMBLOB"
):
|
|