none
java.lang.ClassCastException: java.lang.Integer cannot be cast to java.math.BigInteger RRS feed

  • Question

  • i am new in hibernate and mssql. i am working on Mysql to Mssql integration.

    i am facing this exception:

    java.lang.ClassCastException: java.lang.Integer cannot be cast to java.math.BigInteger

    My code is:

    long salesAlertsCount = ((BigInteger)HibernateUtil.getHibernateSession() .createSQLQuery("SELECT COUNT(a.id) FROM Activity as a,Lead as l WHERE a.what_id=l.id and l.deleted=0 and "+(currentUser.isAdmin()?"a.tenant_id="+currentUser.getTenant_id():" (a.owner_id="+currentUser.getId() +" or a.createdBy_id="+currentUser.getId()+")")+" and "+(currentUser.isAdmin()?"l.tenant_id="+currentUser.getTenant_id():" (l.owner_id="+currentUser.getId()+")")+" and a.deleted=0 and a.action="+Constants.ACTIVITY_ACTION_SEND_SALES_ALERT+"" + " and a.viewed=0 AND a.created>='"+beginingOfMonth+"' ").uniqueResult()).longValue();

    this is my code i am stuck here previously this code working in Mysql but now when i integrate in Mssql it's shows that exception . please anybody help out this

    thank you in advance
    Thursday, December 6, 2018 6:24 AM

Answers