Skip to content

Commit 8f9d1a1

Browse files
dreab8beikov
authored andcommitted
HHH-16094 HHH-17097 MySQL schema generation and validation : tinytext instead of longtext for @lob
1 parent 58b5cea commit 8f9d1a1

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

hibernate-core/src/main/java/org/hibernate/dialect/MySQLDialect.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,16 @@ public Size resolveSize(
152152
//we set scale > 20
153153
size.setScale( Math.min( size.getPrecision(), 20 ) );
154154
return size;
155+
case BLOB:
156+
case NCLOB:
157+
case CLOB:
158+
return super.resolveSize(
159+
jdbcType,
160+
javaType,
161+
precision,
162+
scale,
163+
length == null ? getDefaultLobLength() : length
164+
);
155165
default:
156166
return super.resolveSize( jdbcType, javaType, precision, scale, length );
157167
}
@@ -524,8 +534,7 @@ public SizeStrategy getSizeStrategy() {
524534

525535
@Override
526536
public long getDefaultLobLength() {
527-
//max length for mediumblob or mediumtext
528-
return 16_777_215;
537+
return Integer.MAX_VALUE;
529538
}
530539

531540
@Override

0 commit comments

Comments
 (0)