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 shows that exception.
Thank you in advance