Hibernate 6 Enum in HQL WHERE clause giving wrong result

Hi,
My sample query here used to work all versions before Hibernate 6. But this query no longer works with Hibernate 6.1.3.Final version. Not sue if its a bug or my configuration problem. I am using mysql8 db.

public List<Customer> getAllCustomers(Customer.PhoneType type) {
        Session session = entityManager.unwrap(Session.class);

        Query query = session.createQuery("SELECT c FROM Customer c WHERE (:phoneType IS NULL OR c.type = :phoneType)", Customer.class);
        query.setParameter("phoneType", type);
        List<Customer> customerList = query.getResultList();
        return customerList;
    }

Enum mapped in customer entity like this:

@Entity
@Table(name = "CUSTOMER")
public class Customer {

    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    int id;    

    @Enumerated(EnumType.STRING)
    @Column(name = "type")
    private PhoneType type;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }
    
    public PhoneType getType() {
        return type;
    }

    public void setType(PhoneType type) {
        this.type = type;
    }

    public enum PhoneType {
        MOBILE,
        LAND_LINE;
    }
}

Hibernate throws this exception:

org.springframework.orm.jpa.JpaSystemException: Could not determine neither the SqlTypedMapping nor the Bindable value for SqmParameter: SqmNamedParameter(phoneType)
	at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(HibernateJpaDialect.java:321) ~[spring-orm-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(HibernateJpaDialect.java:233) ~[spring-orm-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(AbstractEntityManagerFactoryBean.java:550) ~[spring-orm-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.dao.support.ChainedPersistenceExceptionTranslator.translateExceptionIfPossible(ChainedPersistenceExceptionTranslator.java:61) ~[spring-tx-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.dao.support.DataAccessUtils.translateIfNecessary(DataAccessUtils.java:242) ~[spring-tx-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:152) ~[spring-tx-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:755) ~[spring-aop-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:706) ~[spring-aop-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at com.ets.CustomerDaoImpl$$SpringCGLIB$$0.getAllCustomers(<generated>) ~[classes/:na]
	at com.ets.CustomerService.getAllCustomers(CustomerService.java:16) ~[classes/:na]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:577) ~[na:na]
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) ~[spring-aop-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196) ~[spring-aop-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:755) ~[spring-aop-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:123) ~[spring-tx-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:388) ~[spring-tx-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:119) ~[spring-tx-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184) ~[spring-aop-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:755) ~[spring-aop-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:706) ~[spring-aop-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at com.ets.CustomerService$$SpringCGLIB$$0.getAllCustomers(<generated>) ~[classes/:na]
	at com.ets.CustomerController.getAllCustomers(CustomerController.java:25) ~[classes/:na]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:577) ~[na:na]
	at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:207) ~[spring-web-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:152) ~[spring-web-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:117) ~[spring-webmvc-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:900) ~[spring-webmvc-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:813) ~[spring-webmvc-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1080) ~[spring-webmvc-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:973) ~[spring-webmvc-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1003) ~[spring-webmvc-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:895) ~[spring-webmvc-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:668) ~[servlet-api.jar:5.0.0]
	at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:880) ~[spring-webmvc-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at jakarta.servlet.http.HttpServlet.service(HttpServlet.java:777) ~[servlet-api.jar:5.0.0]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:223) ~[catalina.jar:10.0.23]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) ~[catalina.jar:10.0.23]
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53) ~[tomcat-websocket.jar:10.0.23]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) ~[catalina.jar:10.0.23]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) ~[catalina.jar:10.0.23]
	at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100) ~[spring-web-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) ~[catalina.jar:10.0.23]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) ~[catalina.jar:10.0.23]
	at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93) ~[spring-web-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) ~[catalina.jar:10.0.23]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) ~[catalina.jar:10.0.23]
	at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:124) ~[spring-boot-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
	at org.springframework.boot.web.servlet.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:99) ~[spring-boot-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.boot.web.servlet.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:117) ~[spring-boot-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) ~[catalina.jar:10.0.23]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) ~[catalina.jar:10.0.23]
	at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201) ~[spring-web-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116) ~[spring-web-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:185) ~[catalina.jar:10.0.23]
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:158) ~[catalina.jar:10.0.23]
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:197) ~[catalina.jar:10.0.23]
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:97) ~[catalina.jar:10.0.23]
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:542) ~[catalina.jar:10.0.23]
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:119) ~[catalina.jar:10.0.23]
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92) ~[catalina.jar:10.0.23]
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690) ~[catalina.jar:10.0.23]
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:78) ~[catalina.jar:10.0.23]
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:356) ~[catalina.jar:10.0.23]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:399) ~[tomcat-coyote.jar:10.0.23]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65) ~[tomcat-coyote.jar:10.0.23]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:867) ~[tomcat-coyote.jar:10.0.23]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1762) ~[tomcat-coyote.jar:10.0.23]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) ~[tomcat-coyote.jar:10.0.23]
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191) ~[tomcat-util.jar:10.0.23]
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659) ~[tomcat-util.jar:10.0.23]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) ~[tomcat-util.jar:10.0.23]
	at java.base/java.lang.Thread.run(Thread.java:833) ~[na:na]
Caused by: org.hibernate.query.sqm.sql.ConversionException: Could not determine neither the SqlTypedMapping nor the Bindable value for SqmParameter: SqmNamedParameter(phoneType)
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.resolveSqmParameter(BaseSqmToSqlAstConverter.java:5284) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.consumeSqmParameter(BaseSqmToSqlAstConverter.java:4876) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.consumeSingleSqmParameter(BaseSqmToSqlAstConverter.java:4968) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.consumeSqmParameter(BaseSqmToSqlAstConverter.java:4963) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitNamedParameterExpression(BaseSqmToSqlAstConverter.java:4867) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitNamedParameterExpression(BaseSqmToSqlAstConverter.java:414) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.tree.expression.SqmNamedParameter.accept(SqmNamedParameter.java:56) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitIsNullPredicate(BaseSqmToSqlAstConverter.java:6684) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitIsNullPredicate(BaseSqmToSqlAstConverter.java:414) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.tree.predicate.SqmNullnessPredicate.accept(SqmNullnessPredicate.java:53) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitJunctionPredicate(BaseSqmToSqlAstConverter.java:6344) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitJunctionPredicate(BaseSqmToSqlAstConverter.java:414) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.tree.predicate.SqmJunctionPredicate.accept(SqmJunctionPredicate.java:74) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitGroupedPredicate(BaseSqmToSqlAstConverter.java:6323) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitGroupedPredicate(BaseSqmToSqlAstConverter.java:414) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.tree.predicate.SqmGroupedPredicate.accept(SqmGroupedPredicate.java:52) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitWhereClause(BaseSqmToSqlAstConverter.java:2262) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitQuerySpec(BaseSqmToSqlAstConverter.java:1833) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitQuerySpec(BaseSqmToSqlAstConverter.java:414) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.tree.select.SqmQuerySpec.accept(SqmQuerySpec.java:122) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.spi.BaseSemanticQueryWalker.visitQueryPart(BaseSemanticQueryWalker.java:213) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitQueryPart(BaseSqmToSqlAstConverter.java:1689) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitSelectStatement(BaseSqmToSqlAstConverter.java:1487) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.visitSelectStatement(BaseSqmToSqlAstConverter.java:414) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.tree.select.SqmSelectStatement.accept(SqmSelectStatement.java:199) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.sql.BaseSqmToSqlAstConverter.translate(BaseSqmToSqlAstConverter.java:709) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.buildCacheableSqmInterpretation(ConcreteSqmSelectQueryPlan.java:350) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.withCacheableSqmInterpretation(ConcreteSqmSelectQueryPlan.java:270) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.internal.ConcreteSqmSelectQueryPlan.performList(ConcreteSqmSelectQueryPlan.java:246) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.internal.QuerySqmImpl.doList(QuerySqmImpl.java:537) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.spi.AbstractSelectionQuery.list(AbstractSelectionQuery.java:363) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.sqm.internal.QuerySqmImpl.list(QuerySqmImpl.java:987) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at org.hibernate.query.Query.getResultList(Query.java:94) ~[hibernate-core-6.1.3.Final.jar:6.1.3.Final]
	at com.ets.CustomerDaoImpl.getAllCustomers(CustomerDaoImpl.java:23) ~[classes/:na]
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[na:na]
	at java.base/java.lang.reflect.Method.invoke(Method.java:577) ~[na:na]
	at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343) ~[spring-aop-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196) ~[spring-aop-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:755) ~[spring-aop-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:137) ~[spring-tx-6.0.0-SNAPSHOT.jar:6.0.0-SNAPSHOT]
	... 74 common frames omitted

If I add class type parameter
query.setParameter(“phoneType”, type, Customer.PhoneType.class);
Hibernate does not throw exception but gives wrong result set.

When I look at sql output I can see binding parameter is SMALINT (Which I guess suppose to be VARCHAR). Here is the output:

org.hibernate.SQL: select c1_0.id,c1_0.customer_name,c1_0.email,c1_0.type from customer c1_0 where (? is null or c1_0.type=?)
org.hibernate.orm.jdbc.bind: binding parameter [1] as [SMALLINT] - [LAND_LINE]
org.hibernate.orm.jdbc.bind: binding parameter [2] as [SMALLINT] - [LAND_LINE]

Hi @jaks80 ,

I think your problem is related to [HHH-15498] - Hibernate JIRA.

This issue is resolved in Hibernate Core 6.1.4.Final. Thanks for fixing this issue.