Issue Details (XML | Word | Printable)

Key: HHH-2669
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Steve Ebersole
Reporter: Steve Ebersole
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Hibernate Core

Unequivocally map MySQL LOB types to the LONG variant

Created: 11/Jun/07 03:43 PM   Updated: 01/May/09 02:46 PM   Resolved: 17/Oct/07 12:27 AM
Component/s: core
Affects Version/s: None
Fix Version/s: 3.3.0.CR1

Time Tracking:
Not Specified

Participants: Gail Badner, Mark Matthews, Max Bowsher and Steve Ebersole


 Description  « Hide

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.



Mark Matthews added a comment - 11/Jun/07 04: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 added a comment - 11/Jun/07 04: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 added a comment - 17/Oct/07 12:27 AM

applied to trunk


Max Bowsher added a comment - 21/Apr/09 08:17 AM

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 added a comment - 01/May/09 02: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?