title: I am getting java.math.BigInteger cannot be cast to java.lang.Integer at return (ArrayList<String[]>) query.list(); in below code plz suggest solution
body: <p><img src="https://i.stack.imgur.com/YNcwz.png" alt="1" /></p>
  <p>In hibernate 3 version it was working fine but now I have upgraded it to hibernate version 5 and  java.math.BigInteger cannot be cast to java.lang.Integer this error is coming</p>
  <pre><code>  @Override
      public ArrayList&lt;String[]&gt; getInvoiceDetails(
              BigInteger premiumFeeRelationshipId) {
          LOGGER.info(METHOD_START);
          sessionFactory = getSessionFactory();
          if(sessionFactory!=null){
          session = sessionFactory.openSession();
          }
          Query query = session.createQuery(BrmsCommonConstants.GETINVOICEDETAILS);
          query.setParameter(0, premiumFeeRelationshipId);
          
          LOGGER.info(METHOD_END);
          return (ArrayList&lt;String[]&gt;) query.list();
      }
  </code></pre>
  <blockquote>
  <p>Error java.lang.ClassCastException: java.math.BigInteger cannot be
  cast to java.lang.Integer     at
  org.hibernate.type.descriptor.java.IntegerTypeDescriptor.unwrap(IntegerTypeDescriptor.java:19)
  ~[hibernate-core-5.5.4.Final.jar:5.5.4.Final]     at
  org.hibernate.type.descriptor.sql.IntegerTypeDescriptor$1.doBind(IntegerTypeDescriptor.java:46)
  ~[hibernate-core-5.5.4.Final.jar:5.5.4.Final]</p>
  </blockquote>