hibernate-orm
hibernate-orm copied to clipboard
Reproducer for incorrect function argument domain type
Reproducer that argument type is not properly resolvable from SqmFunction return type resolvers.
Test fails with:
Unexpected type ==> expected: <org.hibernate.type.CustomType> but was: <org.hibernate.metamodel.model.domain.internal.BasicTypeImpl>
Expected :org.hibernate.type.CustomType
Actual :org.hibernate.metamodel.model.domain.internal.BasicTypeImpl
Thanks for your pull request!
This pull request does not follow the contribution rules. Could you have a look?
❌ All commit messages should start with a JIRA issue key matching pattern HHH-\d+
↳ Offending commits: [782b4878e6b527fd09813dc702c5f6afb1c02e6b]
› This message was automatically generated.
A "work around" seems to be to get the entity name and attribute name from the SqmTypedNode and look it up in the Metamodel, although this requires access to the SessionFactory which is only accessible through a deprecated method:
typeConfiguration.getSessionFactory().getMappingMetamodel()
.getEntityDescriptor(((SqmRoot) ((SqmBasicValuedSimplePath) arguments.get(0)).getLhs()).getEntityName())
.getPropertyType(((SqmBasicValuedSimplePath) arguments.get(0)).getNavigablePath().getLocalName());