|
42 | 42 | import org.hibernate.metamodel.model.domain.BasicDomainType; |
43 | 43 | import org.hibernate.metamodel.model.domain.DomainType; |
44 | 44 | import org.hibernate.metamodel.model.domain.JpaMetamodel; |
45 | | -import org.hibernate.metamodel.model.domain.PluralPersistentAttribute; |
| 45 | +import org.hibernate.metamodel.model.domain.SingularPersistentAttribute; |
46 | 46 | import org.hibernate.metamodel.model.domain.TupleType; |
47 | 47 | import org.hibernate.metamodel.model.domain.internal.DiscriminatorSqmPathSource; |
48 | 48 | import org.hibernate.metamodel.model.domain.internal.EmbeddedSqmPathSource; |
|
74 | 74 | import org.hibernate.query.sqm.SetOperator; |
75 | 75 | import org.hibernate.query.sqm.SortOrder; |
76 | 76 | import org.hibernate.query.sqm.SqmExpressible; |
| 77 | +import org.hibernate.query.sqm.SqmPathSource; |
77 | 78 | import org.hibernate.query.sqm.SqmQuerySource; |
78 | 79 | import org.hibernate.query.sqm.TemporalUnit; |
79 | 80 | import org.hibernate.query.sqm.TrimSpec; |
@@ -1830,19 +1831,25 @@ private static <T> BindableType<T> resolveInferredParameterType( |
1830 | 1831 | //noinspection unchecked |
1831 | 1832 | return (BindableType<T>) typeInferenceSource; |
1832 | 1833 | } |
1833 | | - |
1834 | | - if ( typeInferenceSource.getNodeType() != null ) { |
1835 | | - //noinspection unchecked |
1836 | | - return (BindableType<T>) typeInferenceSource.getNodeType(); |
| 1834 | + final SqmExpressible<?> nodeType = getNodeType( typeInferenceSource ); |
| 1835 | + if ( nodeType != null ) { |
| 1836 | + return (BindableType<T>) nodeType; |
1837 | 1837 | } |
1838 | 1838 | } |
1839 | 1839 |
|
1840 | | - if ( value == null ) { |
1841 | | - return null; |
1842 | | - } |
| 1840 | + return value == null ? null : (BasicType<T>) typeConfiguration.getBasicTypeForJavaType( value.getClass() ); |
| 1841 | + } |
1843 | 1842 |
|
1844 | | - //noinspection unchecked |
1845 | | - return (BasicType<T>) typeConfiguration.getBasicTypeForJavaType( value.getClass() ); |
| 1843 | + private static SqmExpressible<?> getNodeType(SqmExpression<?> expression) { |
| 1844 | + if ( expression instanceof SqmPath<?> ) { |
| 1845 | + final SqmPathSource<?> pathSource = ( (SqmPath<?>) expression ).getResolvedModel(); |
| 1846 | + return pathSource instanceof SingularPersistentAttribute<?, ?> ? |
| 1847 | + ( (SingularPersistentAttribute<?, ?>) pathSource ).getPathSource() : |
| 1848 | + pathSource; |
| 1849 | + } |
| 1850 | + else { |
| 1851 | + return expression.getNodeType(); |
| 1852 | + } |
1846 | 1853 | } |
1847 | 1854 |
|
1848 | 1855 | @Override |
|
0 commit comments