jdaugherty commented on code in PR #16020:
URL: https://github.com/apache/grails-core/pull/16020#discussion_r3611853115
##########
grails-data-hibernate7/core/src/main/groovy/org/grails/orm/hibernate/cfg/domainbinding/binder/SimpleValueBinder.java:
##########
@@ -84,7 +85,20 @@ public SimpleValue bindSimpleValue(
String path) {
PropertyConfig propertyConfig = property.getHibernateMappedForm();
- simpleValue.setTypeName(property.getTypeName(simpleValue));
+ String typeName = property.getTypeName(simpleValue);
+ if (isUnboundedTextType(typeName) && simpleValue instanceof BasicValue
basicValue) {
+ // Hibernate's legacy named-type lookup resolves "text" to
StandardBasicTypes.TEXT,
+ // whose JDBC type code is the legacy java.sql.Types.LONGVARCHAR.
Dialects (e.g.
+ // Postgres) don't render that legacy code as their native
unbounded text/CLOB type,
+ // falling back instead to a bounded VARCHAR at Hibernate's
generic Length.LONG
+ // default (32600) when no explicit column length is set - see
GH-16010. The modern
+ // SqlTypes.LONG32VARCHAR code is what dialects actually map to an
unbounded type, so
+ // bind that directly rather than going through the ambiguous
legacy type name.
+ basicValue.setExplicitJdbcTypeAccess(
Review Comment:
Isn't this dialect specific? This silently changes the DDL of type: 'text'
on H2, MySQL/MariaDB, Oracle, and SQL Server:
- H2 (the default test/dev DB): LONG32VARCHAR → character large object/clob
rather than whatever LONGVARCHAR rendered before.
- Oracle: → clob instead of the legacy path.
- SQL Server: → varchar(max).
- MySQL: → longtext.
i think this is ok, but I think in hiberate5 it was only supported if the
dialect supported it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]