ERROR: operator does not exist: text = integer
<p>I am using Spring boot with Postgresql. I want to extract data from excel sheet and save it to database using JPA. When I try to fire the query using JPA I get the error. </p>

<pre><code>ERROR: operator does not exist: text = integer
  Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
  Position: 59
</code></pre>

<p>1.Entity class</p>

<pre><code>@Entity
@Table(name = "corporate_cluster", schema = "TARGET")  
public class CorporateClusterDto {

    @Id
    private Integer cls_id;
    private.....

}
</code></pre>

<p>2.Repository</p>

<pre><code>public interface CorporateClusterRepository extends
            JpaRepository&lt;Decluster, Long&gt; {

    @Query(value = "SELECT EXISTS(SELECT 1 FROM corporate_cluster WHERE cls_id=?1)", nativeQuery = true)
    public Boolean existsByClsId(Integer cls_id);

}
</code></pre>

<p>3.Service class code snippet
Here, I want to get data from first cell of the excel sheet and check whether it exists in the table. I want to avoid exponential values like 1.0036399E7, I want them in format like 10036399, that's why I used <code>BigDecimal</code>.</p>

<pre><code>public class FileUploadService {

    public void upload(){
        boolean isOldClsCorporateCluster = corporateClusterRepository.existsByClsId(new BigDecimal(row.getCell(0).getNumericCellValue()).intValue());
    }
}
</code></pre>

<p>4.Stacktrace:</p>

<pre><code>Hibernate: SELECT EXISTS(SELECT 1 FROM corporate_cluster WHERE cls_id=?)
2016-08-30 09:20:02.969  WARN 532 --- [nio-8084-exec-1] o.h.engine.jdbc.spi.SqlExceptionHelper   : SQL Error: 0, SQLState: 42883
2016-08-30 09:20:02.970 ERROR 532 --- [nio-8084-exec-1] o.h.engine.jdbc.spi.SqlExceptionHelper   : ERROR: operator does not exist: text = integer
  Hint: No operator matches the given name and argument type(s). You might need to add explicit type casts.
  Position: 59
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not extract ResultSet
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1763)
    at org.hibernate.jpa.spi.AbstractEntityManagerImpl.convert(AbstractEntityManagerImpl.java:1677)
    at org.hibernate.jpa.internal.QueryImpl.getSingleResult(QueryImpl.java:524)
    at org.springframework.data.jpa.repository.query.JpaQueryExecution$SingleEntityExecution.doExecute(JpaQueryExecution.java:206)
    at org.springframework.data.jpa.repository.query.JpaQueryExecution.execute(JpaQueryExecution.java:78)
    at org.springframework.data.jpa.repository.query.AbstractJpaQuery.doExecute(AbstractJpaQuery.java:100)
    at org.springframework.data.jpa.repository.query.AbstractJpaQuery.execute(AbstractJpaQuery.java:91)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:462)
    at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:440)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.data.jpa.repository.support.CrudMethodMetadataPostProcessor$CrudMethodMetadataPopulatingMethodInterceptor.invoke(CrudMethodMetadataPostProcessor.java:131)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
    at com.sun.proxy.$Proxy99.existsByClsId(Unknown Source)
</code></pre>