Unequivocally map MySQL LOB types to the LONG variant

Description

MySQL differentiates different "sizes" of LOBs. Apparently, the smaller types offer no storage benefit nor performance gain. So we should consider mapping the LOB types in the MySQL dialect to the LON variants in all cases.

The current setup causes truncation headaches for users, apparently unnecessarily.

Environment

None

Activity

Show:
Mark Matthews
June 11, 2007, 11:06 PM

Just a quick comment validating Steve's approach, since we discussed this in IRC on freenode and I asked around internally (and went through the source of the server), and this is indeed the case. The different BLOB/TEXT types seem to be designed to prevent storage over-allocation, since MySQL doesn't have CHECK CONSTRAINT.

Steve Ebersole
June 11, 2007, 11:12 PM

Right, specifically the discussion revolved around the default environment should be something that "just works". For those that need to be cognizant of this, it is easy enough to supply a custom dialect reverting to the current behavior.

Steve Ebersole
October 17, 2007, 7:27 AM

applied to trunk

Max Bowsher
April 21, 2009, 3:17 PM

I just upgraded from 3.2.x to 3.3.x (yes, a bit late, I know) and found my generated schema changing types under me. OK, that I more-or-less expected.
But I did expect that I ought to be able to override Hibernate's default decisions using <property length="NNNN"/>.

I've got no problem with changing the default to be the long* variants, but surely an explicit length request should still select the most appropriate MySQL type?

Gail Badner
May 1, 2009, 9:46 PM

Mark, I noticed that the fix to MySQLDialect.java commented out:

// registerColumnType( Types.VARCHAR, 16777215, "mediumtext" );
// registerColumnType( Types.VARCHAR, 65535, "text" );

but did not comment out the following:

registerColumnType( Types.VARBINARY, 16777215, "mediumblob" );
registerColumnType( Types.VARBINARY, 65535, "blob" );

Should these also be commented out?

Assignee

Steve Ebersole

Reporter

Steve Ebersole

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Major
Configure