Getting exception while executing IT test case when we upgrade hibernate to from

When we are upgrading hibernate version to and then running IT test case then we are getting the below exception but the same ITs are getting passed when the hibernate version is

Below are the exception details which we are getting in hibernate:

org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute statement; SQL [n/a]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute statement

    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.convertHibernateAccessException(
    at org.springframework.orm.jpa.vendor.HibernateJpaDialect.translateExceptionIfPossible(
    at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.translateExceptionIfPossible(
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(

**Below is the exception that we are getting related to PostGres.**

Caused by: org.postgresql.util.PSQLException: ERROR: column “emp_id” is of type integer but expression is of type bytea
Hint: You will need to rewrite or cast the expression.
Position: 64
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(
at org.postgresql.core.v3.QueryExecutorImpl.processResults(
at org.postgresql.core.v3.QueryExecutorImpl.execute(
at org.postgresql.jdbc.PgStatement.executeInternal(
at org.postgresql.jdbc.PgStatement.execute(
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(
at org.postgresql.jdbc.PgPreparedStatement.executeUpdate(
at com.zaxxer.hikari.pool.ProxyPreparedStatement.executeUpdate(
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.executeUpdate(
at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(
… 50 more

**Below are the versions which are being used in the project:**

> <hibernate.version>5.2.1.Final</hibernate.version>
>         <hibernate-extensions.version>1.2.1</hibernate-extensions.version>
>         <hibernate.validator.version>6.0.18.Final</hibernate.validator.version>
>         <hibernate-jpa-21.version>1.0.0.Final</hibernate-jpa-21.version>
>         <validation-api.version>2.0.0.Final</validation-api.version>
>         <postgres.jdbc.driver.version>42.2.6</postgres.jdbc.driver.version>

Without more details I can’t help you here. Apparently you are executing a query like .. where id = ? and you are binding null, which by default will bind the null as binary type. I need to see the HQL and SQL query to help you further. Like the exception message already tells you, you can make this work by using a cast i.e. use the following ... where id = cast(? as int)