The problem was already described in which was closed in 2012 because of some in-progress rewrites. Now (2014) the problem still exists:
MySQL defines "effective" maximum lengths of text columns. "Effective" in the case means the length in bytes, not in characters. If the database charset is utf-8 (which nowadays is default in almost all cases), mysql allows the creation of columns of 1/3 of the defined length.
The correct lengths for varchar fields are:
0...21845 -> Varchar(length)
21846...5592405 -> mediumtext
more -> longtext
So the correct implementation of registerVarcharTypes is:
This fix is independent of any rewrite of the length-logic! It is nessecary to make hibernate's mysql(5) dialect work correctly.
The workaround in ("Until then, please explicitly define column lengths on your varchars or use a custom dialect that extends/overrides MySQL5Dialect.") is invalid since it breaks database compatibility.
The behaviour of mysql is described in http://dev.mysql.com/doc/refman/5.6/en/column-count-limit.html
According to this it really would make sense to use varchar only up to 255 (or less) characters because the maximum row size is 65535 - where varchar counts but text not. So an improvement of the above would be:
This bug report does not indicate that the reported issue affects version 5.x. Versions prior to 5.x are no longer maintained. It would be a great help to the Hibernate team and community for someone to verify that the reported issue still affects version 5.x. If so, please add the 5.x version that you verified with to the list of affected-versions and attach the (preferably SSCCE) test case you used to do the verification to the report; from there the issues will be looked at during our triage meetings.
For details, see http://in.relation.to/2015/10/27/great-jira-cleanup-2015/
As part of verifying that this issue affects 5.0, please just set the "Affects version". Leave the "verify-affects-5.0" label and leave the issue in "Awaiting Response" status; these are critical for us to be able to track these verifications and triage them. Thanks.