Tristan Lins (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HHH-16253 (
https://hibernate.atlassian.net/browse/HHH-16253?atlOrigin=eyJpIjoiOWViZj...
)
Re: [Envers] Schema Validation Failure With Audited (N)Clob Column with Hibernate 6 on H2
(
https://hibernate.atlassian.net/browse/HHH-16253?atlOrigin=eyJpIjoiOWViZj...
)
I digged into the code and there is something strange.
In both cases, for the Entity#conlusion and Entity_audit#conclusion no
Column#setSqlTypeName (
https://github.com/hibernate/hibernate-orm/blob/6.2.6/hibernate-core/src/...
) is set (the setter is called with NULL ).
When the Column#getSqlTypeName (
https://github.com/hibernate/hibernate-orm/blob/6.2.6/hibernate-core/src/...
) getter is called, the sql type is detected using the ddlTypeRegistry (
https://github.com/hibernate/hibernate-orm/blob/6.2.6/hibernate-core/src/...
).
There are different results.
For the Entity class:
getSqlTypeCode( mapping ) = 2005
getColumnSize( dialect, mapping ) = Size(length = 255, scale = 2)
ddlTypeRegistry.getTypeName( getSqlTypeCode( mapping ), getColumnSize( dialect, mapping )
) = "oid"
But for the Entity_audit class, the ddlTypeRegistry returns varchar:
getSqlTypeCode( mapping ) = 12
getColumnSize( dialect, mapping ) = Size(length = 255, scale = 2)
ddlTypeRegistry.getTypeName( getSqlTypeCode( mapping ), getColumnSize( dialect, mapping )
) = "varchar(255)"
But the issue is not here, the sqlTypeCode was set before.
When BasicValue#resolveColumn (
https://github.com/hibernate/hibernate-orm/blob/6.2.6/hibernate-core/src/...
) is called, the resolution differs.
For the Entity class, the resolution is:
InferredBasicValueResolution(
jdbcType = ClobTypeDescriptor(CLOB_BINDING)
jdbcMapping = basicType(java.lang.String, 2005)
legacyType = basicType(java.lang.String, 2005)
)
And for the Entity_audit class, the resolution is:
NamedBasicTypeResolution(
basicType = basicType(java.lang.String, 12)
)
I’m still searching why the NamedBasicTypeResolution has the wrong type.
(
https://hibernate.atlassian.net/browse/HHH-16253#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-16253#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100232- sha1:4329f54 )