When updating from Mysql 5.1.56 to a newer version of MySQL I encounter problem with automatic adding columns to existing databases.
Here's my error:
ERROR SchemaUpdate:212 - Unsuccessful: alter table Field add column symbolAfter varchar(255)
I've configures hibernate hbm2ddl as follows:
Code:
<property name="hibernate.hbm2ddl.auto">update</property>
I experience this issue no matter what environment I test it on. Locally on a Mac or on our Amazon RDS test server.
Setup:
- Mysql 5.6
- Hibernate 3.6
Hibernate configuration file:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/***</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">******</property>
<property name="hibernate.connection.pool_size">10</property>
<property name="hibernate.cache.use_second_level_cache">true</property>
<property name="hibernate.cache.provider_class">org.hibernate.cache.HashtableCacheProvider</property>
<property name="net.sf.ehcache.configurationResourceName">ehcache.xml</property>
<property name="hibernate.cache.use_query_cache">true</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.setup">true</property>
<property name="current_session_context_class">thread</property>
<property name="hibernate.cglib.use_reflection_optimizer">true</property>
<!-- Drop and re-create or update the database schema on startup -->
<property name="hibernate.hbm2ddl.auto">update</property>
</session-factory>
</hibernate-configuration>