detachedCriteria: java.lang.integer cannot be cast to Long

现象:

DetachedCriteria dc =..;

dc.add(Restrictions.ne("parent.id", 0);

dc = page.toSearch(dc);

..

这时程序报告错误,

java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.Long

修改方法:

DetachedCriteria dc =..;

dc.add(Restrictions.ne("parent.id", 0L);

dc = page.toSearch(dc);

参考:

1 http://community.jaspersoft.com/questions/804058/javalangclasscastexception-javalanginteger-cannot-be-cast-javamathbigdecimal

这是Int转Bigdecimal问题


你可能感兴趣的:(detachedCriteria: java.lang.integer cannot be cast to Long)